![]() |
| | #16 |
| Cheesy Poofs! Join Date: Sep 2002 Location: Boulder
Posts: 1,728
| |
| PJYelton is offline | |
| | #17 |
| mov.w #$1337,D0 Join Date: Nov 2001
Posts: 704
| I dunno, but the gamefiles seem to be missing the actual main function that handles the running of the game... Can we get the working game in full? It would help me out a bit.
__________________ c++->visualc++->directx->opengl->c++; (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.) |
| Jeremy G is offline | |
| | #18 |
| Cheesy Poofs! Join Date: Sep 2002 Location: Boulder
Posts: 1,728
| I just made a stupid little driver to test out the boards functionality, you're welcome to use it. Code: int main()
{
Board myBoard;
printBoard(myBoard);
int z;
while (1)
{
do
{
cin>>z;
}while (!myBoard.canMove(z));
myBoard.move(z, 'X');
printBoard(myBoard);
if (myBoard.checkWin()!=' ')
break;
do
{
cin>>z;
}while (!myBoard.canMove(z));
myBoard.move(z, 'O');
printBoard(myBoard);
if (myBoard.checkWin()!=' ')
break;
}
cout<<"Winner!"<<endl;
cout<<"Testing at function. The character at spot 4,1 is a \'"<<myBoard.at(4, 1)<<"\'"<<endl;
return 0;
}
|
| PJYelton is offline | |
| | #19 |
| Magically delicious Join Date: Oct 2001
Posts: 856
| Here's mine. No manual entry except an enter between moves so I can see how good the AI is at defeating itself. Code: static const char PLAYER1 = 'X';
static const char PLAYER2 = 'O';
int main() {
srand(time(0));
Board board;
char turn = PLAYER1;
while (true) {
int move = <<your namespace here>>::getMove(board, turn);
if (!board.canMove(move)) {
std::cout << "* OUT OF COLUMNS *\n";
break;
}
board.move(move, turn);
printBoard(board);
std::cout << turn << " went in column " << move << std::endl;
if (board.checkWin() != ' ') {
std::cout << turn << " WON THE GAME!\n";
break;
}
std::cin.get();
turn = turn == PLAYER1 ? PLAYER2 : PLAYER1;
}
return 0;
}
|
| LuckY is offline | |
| | #20 |
| C++ Developer Join Date: Jun 2002 Location: UWaterloo
Posts: 2,718
| The only problem is that Connect 4 has been solved. So basically, the second player can always induce at least a draw in every game.
__________________ Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie |
| XSquared is offline | |
| | #21 |
| Cheesy Poofs! Join Date: Sep 2002 Location: Boulder
Posts: 1,728
| Actually thats not true. It HAS been solved but it has been proven to be a win for player 1, not a draw. But coding your AI to implement all of the ideas necessary to win every time as player 1 is a completely different thing and my hats off to anyone here who can do it |
| PJYelton is offline | |
| | #22 |
| Magically delicious Join Date: Oct 2001
Posts: 856
| I was just thinking about it and a nice Win32 app would be a lot nicer to look at than that ugly console program, so I threw together a quick, dirty Connect4 game. The source is attached. Just go into the file YOURDATA.h and replace the defines (they specify your getMove() function and your header file). Then stick your header in the project directory and compile. You can make each move yourself by clicking on the column or click the "Let AI Move" button to let your AI do its job. Tell me what you think and do what you want with the code. If you make any changes I'd love to see them. [edit] I just change the code a tad to allow you to define two different getMove() functions for player 1 and player 2. [/edit] Last edited by LuckY; 10-08-2004 at 02:20 PM. |
| LuckY is offline | |
| | #23 |
| Registered User Join Date: Aug 2003
Posts: 470
| Victor Allis solved connect four for white. But I suspect that for me to understand his thesis and search techniques will take more than a month. |
| okinrus is offline | |
| | #24 |
| Registered User Join Date: Oct 2004
Posts: 1
| Hi All, My C++ is very rusty, but I hope to submit an entry. FYI, I'm a C.S. grad., LabVIEW programmer, and also using [pirated] MSVC 6.0. Regarding previous post: > Victor Allis solved connect four for white does "player 1" = "white"? and can our code determine whether we're playing as "player 1" or "player 2"? Cheers! |
| goodvelo is offline | |
| | #25 | |
| and the hat of marbles Join Date: May 2002 Location: Lund, Sweden
Posts: 2,041
| Quote:
BTW, how are you all doing?
__________________ Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling | |
| Sang-drax is offline | |
| | #26 |
| Its not rocket science Join Date: Jan 2002
Posts: 1,686
| ok count me in....... sounds intresting.. And wahst the maximum time my function can take to make a move... So that I can limit the depth of search trees.... thanx in advance and the driver code has to check for invalid moves... since a rouge function can place its coin anywhere in the array and cheat..
__________________ http://www.geekpursuit.com Last edited by vasanth; 10-14-2004 at 06:22 AM. |
| vasanth is offline | |
| | #27 |
| Cheesy Poofs! Join Date: Sep 2002 Location: Boulder
Posts: 1,728
| Ok, so no guarantee that 'X' moves first? Also, can we assume that the players are always 'X' and 'O'? My AI is more or less done, just in the process of tweaking the eval function a little bit to get the best results. |
| PJYelton is offline | |
| | #28 | |||||
| and the hat of marbles Join Date: May 2002 Location: Lund, Sweden
Posts: 2,041
| Quote:
My current computer is 450 MHz, but I will hopefully have a new laptop when the judging begins. You could make the depth easily changable, so I can decrease it if the function takes too long. Quote:
Quote:
Quote:
Quote:
__________________ Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling | |||||
| Sang-drax is offline | |
| | #29 |
| and the hat of marbles Join Date: May 2002 Location: Lund, Sweden
Posts: 2,041
| I will begin working on the judging program next week, when I have some more time. It won't be anything that advanced.
__________________ Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling |
| Sang-drax is offline | |
| | #30 |
| Cheesy Poofs! Join Date: Sep 2002 Location: Boulder
Posts: 1,728
| Just out of curiosity, is there a particular reason we can't just assume 'X' is going first? Seems like a pointless addition of time to our algorithm to have to figure out who moved first especially when you consider we are being graded on time. No biggee though, just wondering if there was a reason |
| PJYelton is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Action Game - AI Contest | Queatrix | Contests Board | 4 | 01-18-2007 06:55 PM |
| New AI contest: sign up | Sang-drax | Contests Board | 20 | 07-27-2005 05:54 PM |
| chess ai contest | Raven Arkadon | Contests Board | 7 | 07-09-2005 06:38 AM |
| AI Contest Proposal | MadCow257 | Contests Board | 4 | 03-13-2005 03:27 PM |
| Game Design Topic #1 - AI Behavior | TechWins | Game Programming | 13 | 10-11-2002 10:35 AM |