File tree Expand file tree Collapse file tree 2 files changed +14
-19
lines changed
src/main/scala/com/us/dsb/explore/algs/ttt/manual Expand file tree Collapse file tree 2 files changed +14
-19
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 11package 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-
93object 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}
You can’t perform that action at this time.
0 commit comments