![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| Software Programming Software programming talk, ask questions about computer software programming or help others |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| I am making a connect4 clone to learn some programming. How would I evaluate a certain position, and can I compare 7 such evaluations to find the best move for the computer to make? TIA | |||
| Advertisements |
| | #2 | ||
| "Jonathan L." <jl@hotmail.com> wrote in message > > I am making a connect4 clone to learn some programming. > > How would I evaluate a certain position, and can I compare 7 such > evaluations to find the best move for the computer to make? > You've got to know something about the game strategy. Obviously, a position where you connect 4 scores 100, whilst a position where the opponent connects 4 scores 0. You might give a position where you have 2 threes (and thus will inevitably win next round) a score of 99, unless of course the opponent also has a three. I don't know enough about the game to tell you how to evaluate a more normal position, such as when opponent is forced on the next move because you have a three, or when you have several lines of two which could develop into fours. However the basic principle is that you score each position, and create a tree as deep as possible of each legal move. You then play the move that gives the best branch. Since the number of moves is large, you won't have a particularly strong program unless you prune the tree - avoid examining no-hoper moves. This is quite a difficult thing to do, and of course it depends on the evaluation function being able to distinguish between no-hoper moves and a move which temporarily looks weak but in fact leads to a winning strategy. | |||
| | #3 | ||
| On Sun, 06 Jul 2003 18:05:25 GMT, "Jonathan L." <jl@hotmail.com> wrote: >I am making a connect4 clone to learn some programming. > >How would I evaluate a certain position, and can I compare 7 such >evaluations to find the best move for the computer to make? This sort of thing cries out for a search tree. At first you don't evaluate the position, you just try all legal moves. Since there are only 7 this doesn't do too badly. At the next level you have 7 to evaluate for each move you did in the first level, thus a total of 49. The third level will have 343. The fourth 2401. I suspect you can still get good response looking at the fifth at 16807 moves. (Note that it's likely that many of these branches have already been pruned because someone won.) If the computer wins, score 100. If the player wins, score 0. Only at that 5th level do you even try to evaluate the position beyondo win/loss checking. I do not have enough experience with the game to comment on how to evaluate it. Note that I wouldn't hardcode the depth. First, it can be used to adjust difficulty. (I wrote a Reversi clone some time ago--I never beat it at it's highest search depth.) Also, you might find the 6th level at 117649 moves is viable. | |||
| | #4 | ||
| Hello, If you want to delve into this stuff, connect 4 has already been solved for quite some time, see http://connect4.iaw.on.ca/ and download the paper by Victor Allis. If I recall his classes correctly he'll come up with proof-number search sooner or later. HTH Mrk "Jonathan L." <jl@hotmail.com> wrote in message news:Xns93B070D171E65pdopdo@204.127.199.17... > I am making a connect4 clone to learn some programming. > > How would I evaluate a certain position, and can I compare 7 such > evaluations to find the best move for the computer to make? > > TIA | |||
| Featured Websites | ||||
|
![]() |
| Tags: connect |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to connect two computers up? | Stickster | Computer Networking and Servers | 12 | 01-13-2008 2:55 PM |
| Mysql Unable to Connect Error | Andrew Kenna | Database | 0 | 06-10-2007 12:22 AM |
| ODBC - connect ACESS-MySQL | Piet | Database | 0 | 06-10-2007 12:21 AM |
| how to connect to mysql from another computer? | chris | Database | 1 | 05-31-2007 8:48 PM |
| how to connect to a remote computer? | chris | Database | 0 | 05-31-2007 8:48 PM |
| Featured Websites | ||||
|