-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndexOnBoard.cs
36 lines (34 loc) · 913 Bytes
/
IndexOnBoard.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TicTacToe
{
public class IndexOnBoard
{
public IndexOnBoard(int row, int column)
{
this.Row = row;
this.Column = column;
}
public IndexOnBoard(string str)
{
var parts = str.Split(',');
this.Row = int.Parse(parts[0]);
this.Column = int.Parse(parts[1]);
}
public override bool Equals(object obj)
{
var otherIndex = obj as IndexOnBoard;
return this.Row == otherIndex.Row &&
this.Column == otherIndex.Column;
}
public int Row { get; set; }
public int Column { get; set; }
public override string ToString()
{
return $"{this.Row},{this.Column}";
}
}
}