diff --git a/frontend/js/game.js b/frontend/js/game.js
index e69de29..fcf5286 100644
--- a/frontend/js/game.js
+++ b/frontend/js/game.js
@@ -0,0 +1,62 @@
+// import "./tile.js";
+
+class Hand {
+ constructor(option = {}) {
+ this.tiles = option.tiles || [];
+ this.draw = null;
+ this.sort();
+ }
+
+ sort() {
+ this.tiles.sort((a, b) => {
+ if (a.lessThan(b)) return -1;
+ if (b.lessThan(a)) return 1;
+ return 0;
+ });
+ }
+
+ flatten() {
+ if (this.draw) {
+ this.tiles.push(this.draw);
+ this.draw = null;
+ }
+ }
+}
+
+class Wall {
+ constructor() {
+ this.tiles = Tile.generateAll();
+ for (let i = this.tiles.length - 1; i > 0; i--) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [this.tiles[i], this.tiles[j]] = [this.tiles[j], this.tiles[i]];
+ }
+ }
+
+ draw() {
+ return this.tiles.pop();
+ }
+
+ drawHand() {
+ let tiles = [];
+ for (let i = 0; i < 13; i++) {
+ tiles.push(this.draw());
+ }
+ return new Hand({ tiles });
+ }
+}
+
+class Discard {
+ constructor() {
+ this.tiles = [];
+ this.hiddenTiles = []; // for stollen tiles
+ }
+}
+
+class Game {
+ constructor() {
+ this.wall = new Wall();
+ this.hands = Array.from({ length: 4 }, () => this.wall.drawHand());
+ this.discards = Array.from({ length: 4 }, () => new Discard());
+ this.turn = 0;
+ }
+}
\ No newline at end of file
diff --git a/frontend/pages/riichi/chap5.html b/frontend/pages/riichi/chap5.html
index fc809c6..577627a 100644
--- a/frontend/pages/riichi/chap5.html
+++ b/frontend/pages/riichi/chap5.html
@@ -163,8 +163,20 @@
? '
'
: '
';
});
- });
+ // Créer une nouvelle partie et afficher les mains
+ const game = new Game();
+ console.log(game)
+ for (let i = 0; i < 4; i++) {
+ const handDiv = document.getElementById(`hand-${i}`);
+ handDiv.innerHTML = '';
+ for (const tile of game.hands[i].tiles) {
+ const tileDiv = document.createElement('div');
+ tileDiv.innerHTML = tile.getSVG();
+ handDiv.appendChild(tileDiv);
+ }
+ }
+ });