-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessBoard.cs
More file actions
44 lines (41 loc) · 1.09 KB
/
Copy pathChessBoard.cs
File metadata and controls
44 lines (41 loc) · 1.09 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChessAI
{
public class ChessBoard
{
/// <summary>
/// <list>
/// <item>int[0] = col</item>
/// <item>int [1] = row</item>
/// </list>
/// </summary>
public static int[] boardLoc(string loc)
{
int[] location = new int[2];
string temp = loc[1].ToString();
int num = 8 - Int32.Parse(temp);
int lett = loc.ToLower()[0] - 97;
location[1] = num;
location[0] = lett;
return location;
}
/// <summary>
/// <list>
/// <item>int[0] = col</item>
/// <item>int [1] = row</item>
/// </list>
/// </summary>
public static string boardLoc(params int[] loc)
{
string location = "";
string lett = ((char)(loc[1] + 97)).ToString().ToUpper();
location += lett;
location += 8-loc[0];
return location;
}
}
}