-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
54 lines (47 loc) · 1.64 KB
/
Program.cs
File metadata and controls
54 lines (47 loc) · 1.64 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Text;
using chess_cli.board;
using chess_cli.chess;
namespace chess_cli
{
class Program
{
static void Main(string[] args)
{
try
{
//Console.OutputEncoding = Encoding.UTF8;
ChessMatch match = new ChessMatch();
while (!match.finished)
{
try
{
Console.Clear();
Screen.printMatch(match);
Console.WriteLine();
Console.Write("Origin: ");
Position origin = Screen.readChessPosition().toPosition();
match.validateOrigin(origin);
bool[,] possiblePositions = match.board.piece(origin).possibleMoves();
Console.Clear();
Screen.printBoard(match.board, possiblePositions);
Console.WriteLine();
Console.Write("Destiny: ");
Position destiny = Screen.readChessPosition().toPosition();
match.validateDestiny(origin, destiny);
match.play(origin, destiny);
} catch(BoardException e)
{
Console.WriteLine(e.Message);
Console.ReadLine();
}
}
Console.Clear();
Screen.printMatch(match);
} catch (BoardException e)
{
Console.WriteLine(e.Message);
}
}
}
}