Beispiel #1
0
        public void y_move(string heading)
        {
            switch (heading)
            {
            case "N":
                if (PlateauArea.checkValid(position.position_x, position.position_y + 1))
                {
                    position.position_y++;
                }
                else
                {
                    Console.WriteLine("Move out of Plateau Area in Y direction.");
                }
                break;

            case "S":
                //   Console.WriteLine("S");// move toward S

                if (PlateauArea.checkValid(position.position_x, position.position_y - 1))
                {
                    position.position_y--;
                }
                else
                {
                    Console.WriteLine("Move out of Plateau Area in Y direction.");
                }
                break;

            case "W":
                //  Console.WriteLine("W");

                break;

            case "E":
                //   Console.WriteLine("E");

                break;

            default:
                Console.WriteLine("Not valid input.");
                break;
            }
        }
Beispiel #2
0
        public void x_move(string heading)
        {
            switch (heading)
            {
            case "N":
                //       Console.WriteLine("N");
                break;

            case "S":
                //       Console.WriteLine("S");
                break;

            case "W":
                //      Console.WriteLine("W");
                if (PlateauArea.checkValid(position.position_x - 1, position.position_y))
                {
                    position.position_x--;
                }
                else
                {
                    Console.WriteLine("Move out of Plateau Area in X direction.");
                }
                break;

            case "E":
                if (PlateauArea.checkValid(position.position_x + 1, position.position_y))
                {
                    position.position_x++;
                }
                else
                {
                    Console.WriteLine("Move out of Plateau Area in X direction.");
                }
                break;

            default:
                Console.WriteLine("Not valid input.");
                break;
            }
        }