예제 #1
0
        public Board(string[] board, CharacterSymbols characterPiece, CharacterSymbols targetPiece, ISymbolActionStrategy actionStrategy)
        {
            CharacterPiece  = characterPiece;
            TargetPiece     = targetPiece;
            _actionStrategy = actionStrategy;

            //this is null
            Details = new CharacterSymbols[board.Length][];
            var targetCount = 0;

            for (var r = 0; r < board.Length; r++)
            {
                for (var c = 0; c < board.Length; c++)
                {
                    switch ((int)board[r][c])
                    {
                    case (int)CharacterSymbols.Target:
                        Details[r][c] = CharacterSymbols.Target;
                        break;

                    case (int)CharacterSymbols.Bot:
                        Details[r][c] = CharacterSymbols.Bot;
                        break;

                    case (int)CharacterSymbols.Empty:
                        Details[r][c] = CharacterSymbols.Empty;
                        break;

                    default:
                        throw new Exception("Invalid character on board.");
                    }

                    if (Details[r][c] == targetPiece)
                    {
                        targetCount++;
                    }
                }
            }

            CalculatedDefaultCellScore = (100 * targetCount) * .1;
            ScoreRadiationThreshold    = Math.Sqrt(CalculatedDefaultCellScore) * .01;
            Metadata = BuildMetadata();
            RegisterCellRelationshipEvents();
        }
예제 #2
0
 public NpcCharacter(CharacterSymbols characterSymbol, Action <IPlayableLocation> action) : base(characterSymbol)
 {
     _action = action;
 }
예제 #3
0
 public PlayableCharacter(CharacterSymbols characterSymbol, Action <IPlayableLocation> action, Func <IPlayableLocation, IPlayableLocation> moveStrategy) : base(characterSymbol)
 {
     _action       = action;
     _moveStrategy = moveStrategy;
 }
예제 #4
0
 protected Character(CharacterSymbols characterSymbol)
 {
     CharacterSymbol = characterSymbol;
 }