Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
        public string RenderBoardWithBoat(BoatLocation location)
        {
            Board dummyBoard = new Board();

            dummyBoard.PlaceItem(location, StringContants.BoatImage);
            return(this.RenderBoard(dummyBoard));
        }
Ejemplo n.º 3
0
 public void SetPlayerBoatLocation(BoatLocation playerBoatLoaction)
 {
     GetOpponentPlayer().SetOpponentBoatLocation(playerBoatLoaction);
     if (turn == Turn.player2)
     {
         stage = Stage.fireMissile;
     }
     NextTurn();
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 6
0
 public void SetOpponentBoatLocation(BoatLocation location)
 {
     opponentsBoatLocation = location;
     opponentBoard.PlaceItem(location, StringContants.BoatLocation);
 }