Re: [Gtkboard-devel] help writing a game
Status: Beta
Brought to you by:
arvindn
|
From: Arvind N. <ran...@gm...> - 2004-09-27 00:48:04
|
Hi! Well first of all its about a year since I worked on gtkboard, so I might not remember all the details right, but anyway... On 26 Sep 2004 23:37:23 +0100, nelson <gn...@ce...> wrote: > Hello :), Im writing a game for gtkboard, is an entertainment pencil and > paper game,Im firstly trying to write the Machine to Human type, but Im > a bit confused how to connect my machine-turn C code to the game_eval > and game_movegen hooks, you know, I have my own c algorithm for the > machine to choose its move from the existent board, but there is no an The game_eval and game_movegen functions assume that you want to do game tree evaluation (alpha-beta and generalizations thereof; see http://en.wikipedia.org/wiki/Alpha-beta_pruning in case you are not familiar with those algorithms). game_eval and game_movegen are hooks for the eval and movegen algorithms in minimax search. However, I think you're not using minimax, so you don't want to use those. There's a game_search function, which lets you search the position yourself and return the best move. If game_search is non-null, it will be called and minimax/alpha-beta will not be executed. > easy hook where only put the position chosen by the Machine (that > position computed by a function of mine)...instead it seems gtkboard > forces me to use its functions for searching and calculating new > movements (game_eval and game_movegen), that sure are more powerful and > faster that my own but they are not well documented and I cant find out > how to use them. Questions about that: > > - Is there an easy hook where to put the machine move computed by me > (avoiding game_eval and game_movegen)? > > - What value Am I supposed to put on the float *eval argument? > > - How Can I control the turn flow ?, because in my game a human can make > three moves in 3 clicks (3 events) and then pass the turn to the > machine,but it seems gtkboard passes the turn between human and machine > automatically after a one succesful move... Ah! As far as the program is concerned, when you complete one "move", the other player gets the turn. So you are supposed to pretend that a move has not been completed (by returning 0 in X_getmove() rather than 1) and still update the board on the screen. There's some ugly stuff like RENDER_* to do that, but not difficult. Lots of games do such things, such as mastermind. Feel free to ask me again if something was not clear. > My game also will have levels of difficulty (machine thinking a bit > smarter). > > Explaining of the game: > > Initial Board: > > X X X X X X X > X X X X X > X X X > > Simple Rules: > Loose the one who removes the last piece. > In a turn, you can only remove pieces from one row, but you can remove > as many pieces as you want, for example the entire row. In other words: Nim. Yes, you definitely don't want to use alpha-beta for that one :) Fascinating stuff though. I spent about two months reading up the Conway Berlekamp theory and I loved every bit of it. It would be nice to see some Nimlike games in gtkboard. Good luck Arvind > PD: Thanks and sorry for the long text... > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > Gtkboard-devel mailing list > Gtk...@li... > https://lists.sourceforge.net/lists/listinfo/gtkboard-devel > |