File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
workspaces/simon-game/src/app/components Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,32 @@ import { Box } from "./Box.tsx";
4
4
import { playNote } from "../util/playNote.ts" ;
5
5
import { config } from "../constants.ts" ;
6
6
7
+ type GameState = "pre-game" | "game-over" | "player-turn" | "cpu-turn" ;
8
+
7
9
export function App ( ) {
8
10
const [ playerMoves , setPlayerMoves ] = useState < readonly number [ ] > ( [ ] ) ;
11
+ const [ gameState , setGameState ] = useState < GameState > ( "pre-game" ) ;
12
+ const [ _correctMoves , _setCorrectMoves ] = useState < readonly number [ ] > ( [
13
+ 0 , 1 , 2 , 3 ,
14
+ ] ) ;
15
+
16
+ console . log ( _correctMoves , _setCorrectMoves ) ;
17
+
18
+ if ( gameState === "pre-game" ) {
19
+ return (
20
+ < div style = { { display : "flex" , gap : 10 } } >
21
+ < button
22
+ onClick = { ( ) => {
23
+ setGameState ( "cpu-turn" ) ;
24
+ } }
25
+ >
26
+ Start Game
27
+ </ button >
28
+ Simon Game
29
+ </ div >
30
+ ) ;
31
+ }
32
+
9
33
return (
10
34
< >
11
35
< div style = { { display : "flex" , gap : 10 } } >
You can’t perform that action at this time.
0 commit comments