예제 #1
0
 public BoardSpace(int row, int column, char stateChar)
 {
     goat = false;
     tiger = false;
     coords = new CoordinatePair(row, column);
     SetSpaceState(stateChar);
 }
예제 #2
0
파일: Game.cs 프로젝트: kmaddebas/GoatsMVC
 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;
 }
예제 #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);
        }
예제 #4
0
파일: Game.cs 프로젝트: kmaddebas/GoatsMVC
 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;
 }
예제 #5
0
파일: Game.cs 프로젝트: kmaddebas/GoatsMVC
 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;
 }
예제 #6
0
파일: Game.cs 프로젝트: kmaddebas/GoatsMVC
 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;
 }
예제 #7
0
 public BoardSpace(int row, int column)
 {
     goat = false;
     tiger = false;
     coords = new CoordinatePair(row, column);
 }