Skip to content

Commit 4e7dc3d

Browse files
committed
feat: adding player moves and correct moves verifier
1 parent a315cef commit 4e7dc3d

File tree

1 file changed

+5
-1
lines changed
  • workspaces/simon-game/src/app/components

1 file changed

+5
-1
lines changed

workspaces/simon-game/src/app/components/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { Box } from "./Box.tsx";
44
import { playNote } from "../util/playNote.ts";
55
import { config } from "../constants.ts";
66

7+
function isSequenceCorrect(check: number[], correct: number[]): boolean {
8+
return check.every((element, i) => element === correct[i]);
9+
}
10+
711
type GameState = "pre-game" | "game-over" | "player-turn" | "cpu-turn";
812

913
export function App() {
@@ -12,7 +16,7 @@ export function App() {
1216
const [_correctMoves, _setCorrectMoves] = useState<readonly number[]>([
1317
0, 1, 2, 3,
1418
]);
15-
19+
console.log(isSequenceCorrect);
1620
console.log(_correctMoves, _setCorrectMoves);
1721

1822
if (gameState === "pre-game") {

0 commit comments

Comments
 (0)