add GameStore
This commit is contained in:
parent
d97ae80c67
commit
1b1b931dfc
7
src/game/gamestore/GameStore.ts
Normal file
7
src/game/gamestore/GameStore.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import { MancalaGame } from "mancala.js";
|
||||||
|
|
||||||
|
export interface GameStore {
|
||||||
|
get(id: string): MancalaGame | undefined;
|
||||||
|
set(id: string, game: MancalaGame): void;
|
||||||
|
remove(id: string): void;
|
||||||
|
}
|
||||||
16
src/game/gamestore/GameStoreImpl.ts
Normal file
16
src/game/gamestore/GameStoreImpl.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { MancalaGame } from "mancala.js";
|
||||||
|
import { GameStore } from "./GameStore";
|
||||||
|
|
||||||
|
export class GameStoreImpl implements GameStore {
|
||||||
|
gameStore: Map<string, MancalaGame> = new Map<string, MancalaGame>()
|
||||||
|
|
||||||
|
get(id: string): MancalaGame | undefined {
|
||||||
|
return this.gameStore.get(id);
|
||||||
|
}
|
||||||
|
set(id: string, game: MancalaGame): void {
|
||||||
|
this.gameStore.set(id, game);
|
||||||
|
}
|
||||||
|
remove(id: string): void {
|
||||||
|
this.gameStore.delete(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user