Esempio n. 1
0
 public BoardSpace(int row, int column, char stateChar)
 {
     goat = false;
     tiger = false;
     coords = new CoordinatePair(row, column);
     SetSpaceState(stateChar);
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 public BoardSpace(int row, int column)
 {
     goat = false;
     tiger = false;
     coords = new CoordinatePair(row, column);
 }