예제 #1
0
        static void Main(string[] args)
        {
            Board board = new Board(6, 6);
            Monster human = new Monster("Human", 'h');
            Monster dog = new Monster("Dog", 'd');
            Coordinate humanLoc = new Coordinate(1, 1);
            Coordinate dogLoc = new Coordinate(4, 4);
            board.AddMonster(humanLoc, human);
            board.AddMonster(dogLoc, dog);
            Console.Out.WriteLine(board);
            Console.Out.WriteLine("Shortest path from 1,1 to 4,4:");
            List<Coordinate> path = board.GetShortestPath(humanLoc, dogLoc);
            Console.Out.WriteLine(path);

            Console.Read();
        }
예제 #2
0
 public void AddMonster(Monster monster)
 {
     // TODO: Error handling or return value to indicate failure
     occupant = monster;
 }
예제 #3
0
 public void AddMonster(Coordinate c, Monster monster)
 {
     Square square = board[c.row, c.col];
     if (!square.HasMonster()) square.AddMonster(monster);
 }