-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathGame.cs
More file actions
71 lines (61 loc) · 2.73 KB
/
Game.cs
File metadata and controls
71 lines (61 loc) · 2.73 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
namespace CheckersCheckpoint
{
public class Game
{
public Game()
{
Board board = new Board();
board.GenerateCheckers();
board.DrawBoard();
Console.WriteLine("\nIf you want to move a checker one space diagonally forward, enter 'move'.");
Console.WriteLine("\nIf a jump is available for one of your checker, you must enter 'jump'.");
string choice = Console.ReadLine();
do
{
switch (choice)
{
case "move":
Console.WriteLine("Enter checker Row to move:");
int row = int.Parse(Console.ReadLine());
Console.WriteLine("Enter checker Column:");
int column = int.Parse(Console.ReadLine());
if (board.SelectChecker(row, column) != null)
{
Checker checker = board.SelectChecker(row, column);
Console.WriteLine("Move to which Row: ");
int newRow = int.Parse(Console.ReadLine());
Console.WriteLine("Move to which Column: ");
int newColumn = int.Parse(Console.ReadLine());
checker.Position = new int[] { newRow, newColumn };
board.DrawBoard();
}
else
{
Console.WriteLine("Invalid input");
Console.WriteLine("Enter a valid checker Row:");
row = int.Parse(Console.ReadLine());
Console.WriteLine("Enter a valid checker Column:");
column = int.Parse(Console.ReadLine());
}
break;
case "jump":
Console.WriteLine("Select checker Row to remove:");
int removeRow = int.Parse(Console.ReadLine());
Console.WriteLine("Select checker Column to remove:");
int removeColumn = int.Parse(Console.ReadLine());
Checker changeChecker = board.SelectChecker(removeRow, removeColumn);
board.RemoveChecker(changeChecker);
board.DrawBoard();
break;
default:
Console.WriteLine("Invalid input.");
break;
}
}
while (board.CheckForWin() != true);
}
}
}