Evaluation function of an abstract strategy game

I'm coding an abstract strategy game with C# & XNA. As for the AI, I'm currently using Negascout and a depth of 5. The following is the description of the game:

The game consists of a board of 6x7 hexagonal locations, 42 hexagonal tiles, and 6 pieces (1 king & 5 pawns) for each player (max 2 players).

During the first phase of the game, the players alternately place a random tile on an empty location of the board. Each tile can have a maximum of 6 arrows pointing at the edges. Some arrows can be double-pointed. The arrows mean the direction/s of movement from that tile. A double-pointed arrow makes a piece move/jump 2 locations if there's a valid location. The players are not allowed to place tiles in their opponent's row if there are still empty locations left on the board.

Once this phase is complete, the next player in turn places his king on any one of the 6 tiles of the row nearest to him. Next, the movement of the pieces commences. Pieces are moved according to the arrows on the tiles. The game is won by capturing or blocking the king.

Ok, so now to my move generation function.

  • Tile placement stage a) Place a tile on the nearest row. The tile is rotated to find the optimal rotation. b) Once the nearest row is full, place a tile on an empty location that is surrounded by locations on all sides (ie no edge of board). Rotate the tile to find the optimal rotation. c) If no locations are found, add all remaining empty locations, trying to find the optimal rotation.

  • King placement stage a) Locate the location with the best tile and place the king there. b) Place the remaining pawns on the remaining empty locations on the row.

  • Movement stage a) If king is attacked, try to attack the attacking piece if that piece is not defended. b) Add moves for all player's pieces that are being attacked. c) Add all opponent pieces that the player can attack. d) Add all locations player can move to.

  • Now to the evaluation function.

  • Tile placement stage score = No. of tiles current player placed so far + current player's tiles on the nearest row - no. of tiles opponent placed so far - opponent's tiles on the furthest row (nearest to the opponent).

  • King placement stage score = current player's tiles on the nearest row - opponent's tiles on the furthest row (nearest to the opponent).

  • Movement stage score = current player's pieces' value - opponent's pieces' value.

  • The weighting of the tiles is 100 for every valid location an arrow points to. The weighting of the pieces is as follows:

    piece value = piece type (king = 10000, pawn = 1000) + mobility + defended - attacked - enprise - blocked

    where: mobilty = no. of locations node can move to (free or occupied by the opponent) * 1000 defended = no. of current player pieces surrounding this piece that can actually move to this location * 1000 attacked = no. of opponent pieces surrounding this piece that can actually move to this location * 1000 blocked = (king = -10000, pawn = -1000) piece cannot move because all arrows point to invalid locations and the piece has no chance of moving again in this game.

    Quite long, but here come my problems:

  • When placing tiles, the AI sometimes places a tile using the wrong rotation (ie. places a tile in location where the arrows point to no valid locations). Sometimes this occurs in his 'home' row.

  • When moving pieces, the AI is ignoring king safety. Moves mostly the king and is captured in about 4-6 moves.

  • Anybody, especially with chess AI experience, has ideas and suggestions on how to improve my AI, in particular my move generation and evaluation functions?

    Thanks Ivan

    btw... If anyone is interested in trying out the mail, just let me know and I'll upload a setup on my website.


    Quite long, but here come my problems:

    Quite long, indeed.

    When placing tiles, the AI sometimes places a tile using the wrong rotation (ie. places a tile in location where the arrows point to no valid locations). Sometimes this occurs in his 'home' row.

    In other words, you have a bug in your code. There's no way to answer this question, even with all this extensive preamble. This question should be in a separate, concisely-phrased question that includes a copy of the relevant code.

    When moving pieces, the AI is ignoring king safety. Moves mostly the king and is captured in about 4-6 moves.

    Same as above. This question can't be answered based on even the extensive preamble you've written.

    My advice to you is to be more concise with your questions, post only the details relevant to the problem, and not to combine multiple questions into a single post.

    Anybody, especially with chess AI experience, has ideas and suggestions on how to improve my AI, in particular my move generation and evaluation functions?

    This is an overly vague question that would normally get closed. If you want some advice about your code, you would have to provide that code in order for anyone to give you a helpful answer that goes beyond blind speculation!

    链接地址: http://www.djcxy.com/p/56368.html

    上一篇: 用于抽象的Minmax算法

    下一篇: 抽象策略游戏的评估功能