예제 #1
0
파일: StartGame.cs 프로젝트: shira789/Games
 static public void Introduction(Board board)
 {
     Console.Clear();
     Console.WriteLine(" *********START*********\n");
     PrintObject.Board(board.Matrix);
     Console.WriteLine("\nYou have finished setting up the game!\n" +
                       "Now choose a point from the enemy board to attack\n");
 }
예제 #2
0
        public void LocateSubmarinesOnBoard(Player player)
        {
            bool   IsSuccess = true;
            string message   = null;

            SetGame.SetUp();

            for (int i = 0; i < player.Submarines.Length; i++)
            {
                do
                {
                    if (!IsSuccess)
                    {
                        message = "Error Placing the submarine, try another points";
                    }
                    Point[]        points    = SetGame.GetSubmarineEdgePoints(player.Submarines[i], player.MyBoard.Matrix, message);
                    PlaceSubmarine placeTool = new PlaceSubmarine(ref player.Submarines[i], points[0], points[1], PlayerA.MyBoard);
                    IsSuccess = placeTool.IsPlaced();
                } while (!IsSuccess);
            }
            PrintObject.Board(PlayerA.MyBoard.Matrix);
        }
예제 #3
0
파일: SetGame.cs 프로젝트: shira789/Games
        public static Point[] GetSubmarineEdgePoints(Submarine submarine, Square[,] matrix, string message = null)
        {
            Point[] endPoints = new Point[2];
            Console.WriteLine(message + "\n");

            Console.WriteLine("Place the following Submarine:\t");
            PrintObject.Submarine(submarine.Size);
            PrintObject.Board(matrix);

            for (int i = 0; i < 2; i++)
            {
                endPoints[i] = new Point();
                InputPoint.GetPoint(ref endPoints[i]);

                if (endPoints[0] == endPoints[1] && endPoints[0] != null)
                {
                    Console.WriteLine("Choose 2 different points from each other");
                    i = 0;
                }
            }

            return(endPoints);
        }
예제 #4
0
파일: SetGame.cs 프로젝트: shira789/Games
 public static void Introduction(Player player)
 {
     Console.WriteLine("Welcome to the Submarine Game! this is your board, and your submarine Territory.\n");
     PrintObject.Board(player.MyBoard.Matrix);
 }