Example #1
0
 public Player(string name = "name")
 {
     this.name             = name;
     personalBoatLocation  = new BoatLocation("A", "1", Orientation.X);
     opponentsBoatLocation = new BoatLocation("A", "1", Orientation.X);
     missileHits           = 0;
 }
Example #2
0
        public string RenderBoardWithBoat(BoatLocation location)
        {
            Board dummyBoard = new Board();

            dummyBoard.PlaceItem(location, StringContants.BoatImage);
            return(this.RenderBoard(dummyBoard));
        }
 public void SetPlayerBoatLocation(BoatLocation playerBoatLoaction)
 {
     GetOpponentPlayer().SetOpponentBoatLocation(playerBoatLoaction);
     if (turn == Turn.player2)
     {
         stage = Stage.fireMissile;
     }
     NextTurn();
 }
Example #4
0
        public BoatLocation RenderCurrentBoats(Player player, string playerString, string move)
        {
            Console.Clear();
            Console.WriteLine(playerString);
            if (move != "")
            {
                this.MoveBoat(player, move);
            }
            BoatLocation boatLocation = player.GetBoatLocation();

            Console.WriteLine(RenderBoardWithBoat(boatLocation));
            return(boatLocation);
        }
Example #5
0
        public void PlaceItem(BoatLocation location, string item)
        {
            string      row         = location.GetRow();
            string      column      = location.GetColumn();
            Orientation orientation = location.GetOrientation();
            int         rowIndex    = BoardDimentions.GetRows().IndexOf(row);
            int         columnIndex = BoardDimentions.GetColumns().IndexOf(column);

            if (orientation == Orientation.X)
            {
                this.boardValue[row][column] = item;
                this.boardValue[BoardDimentions.GetRows()[rowIndex + 1]][column] = item;
                this.boardValue[BoardDimentions.GetRows()[rowIndex + 2]][column] = item;
            }
            if (orientation == Orientation.Y)
            {
                this.boardValue[row][column] = item;
                this.boardValue[row][BoardDimentions.GetColumns()[columnIndex + 1]] = item;
                this.boardValue[row][BoardDimentions.GetColumns()[columnIndex + 2]] = item;
            }
        }
Example #6
0
 public void SetOpponentBoatLocation(BoatLocation location)
 {
     opponentsBoatLocation = location;
     opponentBoard.PlaceItem(location, StringContants.BoatLocation);
 }