public BoardSpace(int row, int column, char stateChar) { goat = false; tiger = false; coords = new CoordinatePair(row, column); SetSpaceState(stateChar); }
public AbstractMove GetValidGoatMove(CoordinatePair start, CoordinatePair end) { foreach (AbstractMove m in state.Goat.FindMoves(state)) { if (isSameMove(m, start, end)) return m; } AbstractMove a = null; return a; }
public void TestCoordPairCreated() { int row = 2; int col = 3; CoordinatePair cs = new CoordinatePair(row, col); Console.WriteLine("Coordinate Pair created: " + cs.ToString()); Assert.IsNotNull(cs); Assert.AreEqual(cs.Row, row); Assert.AreEqual(cs.Column, col); row = 4; col = 5; cs.Row = row; cs.Column = col; Assert.AreEqual(cs.Row, row); Assert.AreEqual(cs.Column, col); }
public AbstractMove getValidGoatPlacementMove(CoordinatePair end) { foreach (AbstractMove m in state.Goat.FindMoves(state)) { if (m is GoatPlacementMove) { if (m.EndSpace.GetColumn() == end.Column && m.EndSpace.GetRow() == end.Row) return m; } } return null; }
private bool isSameMove(AbstractMove m, CoordinatePair start, CoordinatePair end) { if ((m.StartSpace.GetColumn() == start.Column && m .StartSpace.GetRow() == start.Row) && m.EndSpace.GetColumn() == end.Column && m.EndSpace.GetRow() == end.Row) return true; else return false; }
public AbstractMove getValidTigerMove(CoordinatePair start, CoordinatePair end) { List<AbstractMove> moves = state.Tiger.FindMoves(state); if (moves.Count > 0) { foreach (AbstractMove m in moves) { if (isSameMove(m, start, end)) return m; } } return null; }
public BoardSpace(int row, int column) { goat = false; tiger = false; coords = new CoordinatePair(row, column); }