Results 1 to 4 of 4
  1. #1
    BiteMuncher's Avatar
    BiteMuncher is offline Member
    Join Date
    Feb 2011
    Location
    South Africa
    Posts
    51
    Rep Power
    0

    Default Chess AI. Concepts and ideas.

    Hi.
    Does anyone have experience or knowledge developing efficient AI for a simple chess engine. I set myself the challenge of working out the problem in my spare time without any prior knowledge (except my own chess skills) or research but inevitably I ran into shortcomings. I have a fully functioning game. My AI has a competitive opening an defence but falls short on attack. I don't use pre-programmed openings, every move is calculated from scratch.

    (This is just a rough demonstration of my concept so no code supplied)

    My AI structure works as follows;
    >Board Class<
    Contains Square, ChessPiece objects.
    Represents current state of the chess board and positions of all pieces.

    >BoardRating Class<
    "static int getRating(Board brd)"
    Accepts a Board object and returns a int rating. Uses a number of methods such as:
    getMaterialRating() -> Combined value of pieces.
    getLegalMoveRating() -> Scores points for each possible legal move.
    There's a long list of methods scoring points for king square attacks, defense, development etc.
    // if white's turn
    rating += white's rating
    rating -= blacks's rating
    (and vice versa)

    >Chess_AI Class<
    After human player moves, the Controller sends the Board object to;
    pcMove(Board brd) in Chess_AI.
    Assuming the pc is black, this method simulates all legal moves for black, and retrieves an int rating for each resulting Board. The top 3 (depending on difficulty) ratings are saved.
    The pc then simulates each of the top 3 moves again. After each move it switches sides to white.
    Now it simulates every legal move for white and saves the top 3 responses.
    It completes the process by switching sides again, but this time only saving the top response for black.
    The pc then chooses one of the initial top 3 black moves depending on the most favorable outcome (biggest rating gained)

    This system works for development on a crowded board but as soon as a constructive series of moves are needed for an attack, it falls apart.
    Sorry, I only speak machine language. Yes or a No?:confused:

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default Re: Chess AI. Concepts and ideas.

    Maybe you could give a 'deep thought' AI a try; deep thought plays with an ordinary alpha-beta pruning strategy; except when moves are 'interesting'; it increases the search depth and continues the evaluation. The difficult part is to figure out when a move is 'interesting' so that the search depth needs to be increased. Cutting off a search when the algorithm runs out of time, is a cheap life saver.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    BiteMuncher's Avatar
    BiteMuncher is offline Member
    Join Date
    Feb 2011
    Location
    South Africa
    Posts
    51
    Rep Power
    0

    Default Re: Chess AI. Concepts and ideas.

    Yeah I was thinking around the same lines but the problem get's harder as you near the end game. Say the pc has a Rook advantage, it may need to move the Rook 3 or 4 times to get into an advantageous position. Same for a Knight etc. It's very difficult to predict if the first move could lead to something. I was thinking, say Rook h7 is a winning move, but the Rook has some maneuvering to do first. Why not remove the attacking piece from its position, and place it on every open square on the board. Once you find a strong position, work out the shortest distance, if any, to that square and simulate opposition responses to each move. Limit the number of pieces of interest and only process from a dominant position. ?
    Sorry, I only speak machine language. Yes or a No?:confused:

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default Re: Chess AI. Concepts and ideas.

    That's where the 'deep thought' comes in: it'll discover the optimal move sequence by 'serendipity' while evaluating the 'deep' but narrow tree of moves (plies). The difficult part is figuring out when to fire up the 'deep though' on a part of the tree, so that it can evaluate that part of the tree to a (much) deeper level.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Help Please on basic concepts over the phone
    By martineze in forum New To Java
    Replies: 1
    Last Post: 10-09-2013, 03:50 PM
  2. is there INK and STROKES concepts in java
    By javadoubt@gmail.com in forum Java 2D
    Replies: 2
    Last Post: 02-24-2010, 08:52 PM
  3. Concepts escaping me?!
    By skatefreak in forum New To Java
    Replies: 2
    Last Post: 04-29-2009, 03:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •