-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoNotMeltTheSnowman.java
33 lines (30 loc) · 994 Bytes
/
DoNotMeltTheSnowman.java
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
public class DoNotMeltTheSnowman {
public static void main(String[] args)
{
int levelNo = Integer.parseInt(args[0]);
Level level = Levels.getLevels()[levelNo];
Board board = new Board(PieceUtils.charsToPieces(level
.getCharArray(), level.getWidth(), level.getHeight()));
Result result;
do
{
result = board.fireLaser();
board.renderBoard();
if (result == Result.HIT_TARGET)
{
System.out.println("Well done you win");
break;
}
if (result == Result.MELT_SNOWMAN)
{
System.out.println("You melted the snowman");
break;
}
System.out.println("Ener row then column to rotate: ");
int row = IOUtil.readInt();
int column = IOUtil.readInt();
board.rotatePiece(new Coordinate(column, row));
board.clearLasers();
} while (result == Result.MISS);
}
}