-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
57 lines (50 loc) · 2.25 KB
/
Copy pathProgram.cs
File metadata and controls
57 lines (50 loc) · 2.25 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
55
56
57
using System;
namespace Chess
{
class Program
{
static void Main(string[] args)
{
Chesspiece selectedPiece = null;
Chessboard chessboard = new Chessboard();
while (!chessboard.isGameOver)
{
Console.WriteLine("1 = GetPiece(row, column)");
Console.WriteLine("2 = Move(initRow, initCol, toRow, toCol)");
Console.WriteLine("3 = PrintBoard()");
Console.WriteLine("───────────────────────────┼");
Console.Write("Choice: ");
if (int.TryParse(Console.ReadLine(), out int choice))
{
int selectedRow;
int selectedCol;
switch (choice)
{
case 1:
Console.Write("Enter Row: ");
selectedRow = int.Parse(Console.ReadLine());
Console.Write("Enter Column: ");
selectedCol = int.Parse(Console.ReadLine());
selectedPiece = chessboard.GetPiece(selectedRow, selectedCol);
break;
case 2:
Console.Write("Enter initial Row: ");
selectedRow = int.Parse(Console.ReadLine());
Console.Write("Enter initial Column: ");
selectedCol = int.Parse(Console.ReadLine());
Console.Write("Enter final Row: ");
int finalRow = int.Parse(Console.ReadLine());
Console.Write("Enter final Column:" );
int finalCol = int.Parse(Console.ReadLine());
chessboard.move(selectedRow, selectedCol, finalRow, finalCol);
break;
case 3:
chessboard.PrintBoard();
break;
}
}
}
Console.ReadKey();
}
}
}