-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatus.js
More file actions
33 lines (30 loc) · 817 Bytes
/
Status.js
File metadata and controls
33 lines (30 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class Status {
constructor() {
this.status = 'playing';
this.mapValues = [
['', '', ''],
['', '', ''],
['', '', ''],
];
this.phase = 'X';
}
/**
* Проверка что мы "играем", что игра не закончена.
* @returns {boolean} Вернет true, статус игры "играем", иначе false.
*/
isStatusPlaying() {
return this.status === 'playing';
}
/**
* Ставит статус игры в "остановлена".
*/
setStatusStopped() {
this.status = 'stopped';
}
/**
* Меняет фигуру (крестик или нолик).
*/
togglePhase() {
this.phase = this.phase === 'X' ? '0' : 'X';
}
}