wip but I need to sleep

This commit is contained in:
2025-08-09 01:40:42 -04:00
parent a7e339a8ce
commit 2ff5d781fd
12 changed files with 213 additions and 82 deletions

View File

@@ -26,10 +26,11 @@ export type Card =
}
| { kind: "joker"; color: "red" | "black" };
export type Pile = Card[];
export type Stack = Card[];
export type Hand = Card[];
export type Board = Card[];
export type vCard = Card | null | number;
export type Pile<C extends vCard = Card> = C[];
export type Stack<C extends vCard = Card> = C[];
export type Hand<C extends vCard = Card> = C[];
export type Board<C extends vCard = Card> = C[];
export const newDeck = (withJokers = false): Pile =>
suits
@@ -55,13 +56,3 @@ export const shuffle = (cards: Card[]) => {
}
return cards;
};
export type GameState = {
deck: Pile;
hand: Hand;
};
export const newGame = () =>
({
deck: shuffle(newDeck()),
hand: [],
} as GameState);

3
packages/shared/utils.ts Normal file
View File

@@ -0,0 +1,3 @@
import hash, { NotUndefined } from "object-hash";
export const heq = (a: NotUndefined) => (b: NotUndefined) => hash(a) == hash(b);