Skip to content

Commit 5df93ba

Browse files
author
Daniel Barclay
committed
ManualTicTacToe: Moved top-level calls to GameUI.runGame.
1 parent 17fa1f3 commit 5df93ba

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

src/main/scala/com/us/dsb/explore/algs/ttt/manual/GameUI.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,16 @@ object GameUI {
126126
}
127127
}
128128

129+
def runGame(): GameUIResult = {
130+
// ???? construct GameUIState
131+
// ???? _maybe_ move GamUIeState into GameUI and not pass around methods
132+
val initialState =
133+
// ?? maybe clean getting indices; maybe get from index ranges, not
134+
// constructing here (though here exercises refined type_)
135+
GameUIState(GameState.initial, RowIndex(Index(1)), ColumnIndex(Index(1)))
136+
137+
GameUI.getAndDoUiCommands(initialState)
138+
139+
}
140+
129141
}
Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
package com.us.dsb.explore.algs.ttt.manual
22

3-
import cats.syntax.option._
4-
import cats.syntax.either._
5-
import enumeratum.EnumEntry
6-
7-
import scala.annotation.tailrec
8-
93
object ManualTicTacToe extends App {
10-
11-
12-
13-
14-
// ???? move to GameUI
15-
val initialState =
16-
// ?? maybe clean getting indices; maybe get from index ranges, not
17-
// constructing here (though here exercises refined type_)
18-
GameUIState(GameState.initial, RowIndex(Index(1)), ColumnIndex(Index(1)))
19-
20-
val gameResult: GameUI.GameUIResult = GameUI.getAndDoUiCommands(initialState)
21-
println("Result: " + gameResult.text)
22-
4+
val gameResult2 = GameUI.runGame() //???? specify starting user?
5+
println("Result: " + gameResult2.text)
236
}

0 commit comments

Comments
 (0)