Hello!
I have a homework doing a game (checkers). It likes chess. when i begin to write the source code, i face to a big problem. the game can be played against the computer. how can i do this?? i have no idea about it. Please, help me...
my mail adress is raja.karalius@hotmail.com if you have any idea , please post it to me......
Why not start by listing some ideas of how you would like the game to come out - and maybe some small demos of source code. Certain Ideas you think would work. Otherwise no one is going to bother helping you.
There are a couple of ways and different types of AI. The most simple of AI is simply calculating each move and then consider which is the best to take at all times. Normally the move that takes out the most pieces but of course this isn't always the best...
If you have "no idea" how to do it, then it would seem to be beyond your current capacity. However, the general algorithm you want to look at for the AI is called minimax.
I have finished the game. I prefer to use a simple algorithm. The computer calculate the distances between its current position and goal position . then, peg which has an advatage to achive the goal is used by computer.
to wonder the game rule is following;
1 Game Search
In this assignment, you will implement a simple two player adversary board game
derived from Chinese checkers. The board consists of 6x6 = 36 squares with each
player has their pegs in the two corners of the board.
Figure 1: Checkers grid
The goal of the game is to move all of your pegs to the location the opponent has
started. The first one to move their pegs to the other side wins. If no one reaches other
side after 80 turns (40 for each player) the game ends with a draw. The moves are
subject to the following constraints.
• One peg can move forward, backward, left or right one square at a time.
• One peg can jump over other fellow pegs. They cannot jump over opponents
pegs though.
• Cross moves or jumps are not allowed.
You are going to implement an intelligent agent for this game. Your program should
be able to play against a human player. At each turn, your program is supposed to
display the current situation of the board and then ask for the user’s move. Obviously,
the user has to enter the xy-coordinates of the peg he/she wants to move and then
the coordinates of the destination. The program should make the necessary checks
to determine if the user has provided a legal move (if there is a peg in the specified
location and if the destination is a location that the peg can move and so on). Then the
program should reply the move of the user with one of its fellow pegs.
The critical part of the project is to determine a decent move for the fellow pegs at
each turn so that the program can win against the human player. In order to achieve
this goal we will use a simple algorithm. Whenever it is the program’s turn to make a
move, the program should generate all possible legal moves that can performed given
the current configuration of the board. Then it should use a evaluation criterion which
will be the measure of ”desirability” of a given configuration.
The evaluation function will compare the configurations that will appear on the
board after each possible move and choose the move that will create the most desirable
situation. Certainly the evaluation function has to measure this notion of desirability
as mathematical unit. Many ideas can be used to design the evaluation function.
One alternative is to use two opposing criteria. Whenever the fellow pegs are closer
to the destination positions, the desirability of the configuration increases. However if
the pegs are away from each other, desirability decreases since we lose the chance of
jumping over other pegs when they are not in neighbor positions. So a simple evaluation
function can be obtained by subtracting the total distance between the pegs from
the total distance of the pegs to the destination position (You may need to multiply the
total distances with some weights to have a balanced evaluation). Certainly, you can
come up with your own ideas to improve the evaluation function defined here!
• You are advised to implement rst the basics (a simple console interface, detecting
wins, losses and draws, checking acceptable moves and firstly making random
moves).