示例#1
0
        public State Play()
        {
            bool canMove = StateConfiguration.ActualMove < StateConfiguration.Moves.Length && !StateHelper.FinishState(TurtleState);

            while (canMove)
            {
                try
                {
                    Next();
                    canMove = StateConfiguration.ActualMove < StateConfiguration.Moves.Length && !StateHelper.FinishState(TurtleState);
                }
                catch (BusinessException bex)
                {
                    if (bex is InvalidPositionException)
                    {
                        _logger.BusinessFail(BL.EVENT_PLAY_ID, BL.EVENT_PLAY_NAME, new { Id = ID, BEX = bex, Message = "Left table" });
                        return(State.LeftTable);
                    }
                    else
                    {
                        _logger.BusinessFail(BL.EVENT_PLAY_ID, BL.EVENT_PLAY_NAME, new { Id = ID, BEX = bex });
                        return(State.Error);
                    }
                }
            }
            _logger.BusinessSuccess(BL.EVENT_PLAY_ID, BL.EVENT_PLAY_NAME, new { Id = ID, State = TurtleState });
            return(TurtleState);
        }