Beispiel #1
0
        public override EvalState GetScore(EvalState state, SignalWeights weights)
        {
            Grid grid = new Grid(state.Grid);

            int score = 0;

            if (state.Action == TankAction.Right)
            {
                score = -100;
            }
            else
            {
                Position leftPosition = grid.GetLeft();
                char     item         = grid.GetItem(leftPosition);
                if (item == '_')
                {
                    score = 1;
                }
                else if (item == 'B')
                {
                    score = 50;
                }
                else if (item == 'O')
                {
                    score = (grid.Energy > 0 ? 60 : -100);
                }

                grid.Position = new Position(grid.Position.X, grid.Position.Y, leftPosition.Orientation);
            }

            return(new EvalState(GetAction(), state, score, grid));
        }
Beispiel #2
0
        public override EvalState GetScore(EvalState state, SignalWeights weights)
        {
            Grid grid = new Grid(state.Grid);

            int score = 0;
            if (state.Action == TankAction.Right)
            {
                score = -100;
            }
            else
            {
                Position leftPosition = grid.GetLeft();
                char item = grid.GetItem(leftPosition);
                if (item == '_')
                {
                    score = 1;
                }
                else if (item == 'B')
                {
                    score = 50;
                }
                else if (item == 'O')
                {
                    score = (grid.Energy > 0 ? 60 : -100);
                }

                grid.Position = new Position(grid.Position.X, grid.Position.Y, leftPosition.Orientation);
            }

            return new EvalState(GetAction(), state, score, grid);
        }