Esempio n. 1
0
 public ActionHistory(int currentRound, MoveType madeMove, double myCurrentPay, double myTotalPay, double totalPay)
 {
     this._currentRound = currentRound;
     this._madeMove     = madeMove;
     this._myCurrentPay = myCurrentPay;
     this._myTotalPay   = myTotalPay;
     this._totalPay     = totalPay;
     this._consequence  = MoveConsequence.NULL;
 }
Esempio n. 2
0
 public ActionHistory(string robotLogin, int currentRound, List <PossibleAction> possibleActions)
 {
     this._robotLogin      = robotLogin;
     this._currentRound    = currentRound;
     this._possibleActions = possibleActions;
     this._madeMove        = MoveType.NULL;
     this._consequence     = MoveConsequence.NULL;
     this._myCurrentPay    = 0;
     this._myTotalPay      = 0;
 }
Esempio n. 3
0
 public GamePlayServerResponse(int roundNumber, Position myPosition, double MyCurrentPay, double TotalPay, bool HasBigItem, int SmallItem, MoveConsequence Consequence, GamePlayServerResponse response)
 {
     RoundNumber       = roundNumber;
     _myCurrentPay     = MyCurrentPay;
     _totalPay         = TotalPay;
     _hasBigItem       = HasBigItem;
     _smallItemNumber  = SmallItem;
     this.RoundNumber  = roundNumber;
     this.MyPosition   = myPosition;
     this._consequence = Consequence;
     if (response != null)
     {
         Result      = response.Result;
         Message     = response.Message;
         ServerState = response.ServerState;
     }
 }
Esempio n. 4
0
        private BattleshipsMoveResult GenerateMoveResult(MoveConsequence moveConsequence)
        {
            var success    = false;
            var didEndGame = false;
            var message    = "";

            if (moveConsequence == MoveConsequence.Illegal)
            {
                message = "Illegal move!";
            }
            else
            {
                didEndGame = _game.Winner != null;
                success    = true;

                switch (moveConsequence)
                {
                case MoveConsequence.Miss:
                    message = "Miss";
                    break;

                case MoveConsequence.Hit:
                    message = "Hit!";
                    break;

                case MoveConsequence.HitSink:
                    if (didEndGame)
                    {
                        message = "Hit, sink and victory!";
                    }
                    else
                    {
                        message = "Hit and sink!";
                    }
                    break;
                }
            }

            return(new BattleshipsMoveResult(success, message, didEndGame));
        }