Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions workspaces/simon-game/src/app/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,32 @@ import { Box } from "./Box.tsx";
import { playNote } from "../util/playNote.ts";
import { config } from "../constants.ts";

type GameState = "pre-game" | "game-over" | "player-turn" | "cpu-turn";

export function App() {
const [playerMoves, setPlayerMoves] = useState<readonly number[]>([]);
const [gameState, setGameState] = useState<GameState>("pre-game");
const [_correctMoves, _setCorrectMoves] = useState<readonly number[]>([
0, 1, 2, 3,
]);

console.log(_correctMoves, _setCorrectMoves);

if (gameState === "pre-game") {
return (
<div style={{ display: "flex", gap: 10 }}>
<button
onClick={() => {
setGameState("cpu-turn");
}}
>
Start Game
</button>
Simon Game
</div>
);
}

return (
<>
<div style={{ display: "flex", gap: 10 }}>
Expand Down
Loading