-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.cs
45 lines (42 loc) · 1.12 KB
/
Board.cs
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
using System.Security.Permissions;
namespace TicTac
{
public class Board
{
private BoardObject[,] m_GameBoard;
private readonly int r_BoardSize;
public Board(int i_size)
{
r_BoardSize = i_size;
m_GameBoard = new BoardObject[i_size, i_size];
}
public void initBoard()
{
foreach (BoardObject current in m_GameBoard)
{
current.Sign = ePlayerSign.None;
}
}
public int Size
{
get { return r_BoardSize; }
}
public bool isSpotAvialable(int i_Row, int i_Col)
{
bool flag = true;
if (i_Row - 1 < 0 || i_Row - 1 >= r_BoardSize)
{
flag = false;
}
else if (i_Col - 1 < 0 || i_Col - 1 >= r_BoardSize)
{
flag = false;
}
else if (m_GameBoard[i_Row,i_Col].Sign != ePlayerSign.None)
{
flag = false;
}
return flag;
}
}
}