aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/ts/gameTable.ts
blob: c95ddb2363c67948fc8d831ea3295b802feeaead (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Coordinates } from "../../helpers/helpersBack";

export default class gameTable {
    static numberOfSquaresOnGameBoard = 11;
    static gameTable: HTMLTableElement;

    static drawGameTable(): void {
        for (let i = 0; i < gameTable.numberOfSquaresOnGameBoard; i++) {
          let tr = document.createElement("tr");
          for (let j = 0; j < gameTable.numberOfSquaresOnGameBoard; j++) {
            let td = document.createElement("td");
            td.classList.add("chequer");
            td.dataset.count = '0';
            tr.appendChild(td);
          }
          gameTable.gameTable.appendChild(tr);
        }
      }
      static getTd(coords: Coordinates): HTMLElement {
        return gameTable.gameTable.children[coords.y].children[coords.x] as HTMLElement;
      }
}