-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHuman.java
More file actions
32 lines (29 loc) · 938 Bytes
/
Human.java
File metadata and controls
32 lines (29 loc) · 938 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
/**
* Логика игрока - человек. | player logic - human
* @author Timur Muratov
* 06/04/2016
*/
public class Human extends Gamer {
public Human(Game game) {
super(game);
}
@Override
public void step() {
System.out.println("Ход человека | human move (id: " + id + ")");
boolean success = false;
while (!success) {
int position = ConsoleHelper.selectPosition();
if (position == 0) {
game.gameOver = true;
game.looser = id;
return;
}
success = game.convas.setPosition(position, id);
if(!success) System.out.println("повторите попытку, место занято | try again, the cell is not empty");
}
}
@Override
public String who() {
return "Человек | Human";
}
}