|
Main
Date: 04 Mar 2008 18:07:18
From: whystopnow
Subject: Generate a list of legal moves (command-line)
|
I'm looking for a tool that will generate a list of legal moves based on reading a list of moves made (like a .PGN). I'd like to interact with it via command-line. Ideally, I'd just say "here's the file" and it would spit out a list of legal moves - it would know whose turn based on the moves so far. I don't see a way to do this with crafty - there's no option to ask it what the legal moves are, though I imagine it wouldn't be hard to edit the code since it obviously has to generate such a list when it plays. Just wondering if anyone knows of something that already does this that is command-line friendly. Thanks!
|
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
| |
Date: 11 Mar 2008 16:22:37
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
tin Brown wrote: > I agree. That is why I find it hard to believe the alleged 5-10 ELO > point improvement claimed by > Rybka fans for not generating the =B promotion. In most circumstances > =B will not waste any > significant time at all. Not a fan, nor fanboy per se. Just using it as an example, because it is by test, the best program by far... And the 5-10 ELO quote doesn't come from the fan, but regurgitated from the actual programmer and tester. But fundamentally all selective search is a balance and you can always make a case that shows where it is wrong. Even with selective pruning if you can simply never test for something especially in parts of the game where the tree results in bunches of pawn promotions, it is not that big of a stretch that the time is not insignificant. But importantly, I have never used the term "cripple performance", and it is a bit of bad form to attack my premises based on the term you used. I never ever thought it would cripple performance. What I believe is that the performance hit would be significant compared to the gain. Loss-gain. Risk-reward. The key balance of selective search. Never has been always right. It is always more right than wrong. Or don't waste time when the risks is small, when the reward is small.
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
| |
Date: 10 Mar 2008 20:00:11
From: Andy Walker
Subject: Re: Generate a list of legal moves (command-line)
|
In article <[email protected] >, tin Brown <
|
| | |
Date: 10 Mar 2008 16:27:09
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
Andy Walker wrote: > I assume that Rybka at least *understands* B promotions? > If not, then it is going to lose a *lot* of games to engines that > know about this deficiency and promote to a B regardless of the > chessic needs, just to watch Rybka crash and burn on the "illegal" > move. > It is an interesting theory, but I suspect what would happen is that the hash would just become useless (no hits). And it would shorten search for a single turn as it refills the hash with the bishop. This could happen anytime there was a surprising (pruned) move made. But this also brings up another point, is that it is the nature of the UCI that the GUI is responsible for checking for move legality. That the engine is always assumes that the position and the move was legal. Which means that for the original poster that Arena may be a source of code for move legality.
|
| | | |
Date: 11 Mar 2008 19:21:23
From: Wijnand Engelkes
Subject: Re: Generate a list of legal moves (command-line)
|
Rybka allows Bishop promotions, but will never promote to Bishop herself. White: King h8, pawns g7 and h7 Black King e6, Queen g3, Rook b8 White is in check and can promote to 4 different pieces. Rook and Knight allow Qe5 checkmate and promoting to Queen is answered by Kf6 and checkmate next move. The only saving move is g8=B, with stalemate or exchanging everything. Rybka will never "find" this move by White, but if you play g8=B yourself, she will allow it and see the draw. You extremely seldomly need the move (White's) B f2 takes g1. Maybe some program will never consider this move, just to gain speed. A consumer product should play by the rules. So I expect Rybka to play g8=B in the next version. "johnny_t" <[email protected] > schreef in bericht news:[email protected]... > Andy Walker wrote: > >> I assume that Rybka at least *understands* B promotions? >> If not, then it is going to lose a *lot* of games to engines that >> know about this deficiency and promote to a B regardless of the >> chessic needs, just to watch Rybka crash and burn on the "illegal" >> move. >> > > It is an interesting theory, but I suspect what would happen is that the > hash would just become useless (no hits). And it would shorten search for > a single turn as it refills the hash with the bishop. This could happen > anytime there was a surprising (pruned) move made. > > But this also brings up another point, is that it is the nature of the UCI > that the GUI is responsible for checking for move legality. That the > engine is always assumes that the position and the move was legal. > > Which means that for the original poster that Arena may be a source of > code for move legality.
|
| | | | |
Date: 11 Mar 2008 16:14:47
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
Wijnand Engelkes wrote: > Rybka allows Bishop promotions, but will never promote to Bishop herself. > White: King h8, pawns g7 and h7 > Black King e6, Queen g3, Rook b8 > White is in check and can promote to 4 different pieces. > Rook and Knight allow Qe5 checkmate > and promoting to Queen is answered by Kf6 and checkmate next move. > The only saving move is g8=B, with stalemate or exchanging everything. > Rybka will never "find" this move by White, but if you play g8=B yourself, > she will allow it and see the draw. > > You extremely seldomly need the move (White's) B f2 takes g1. > Maybe some program will never consider this move, just to gain speed. > A consumer product should play by the rules. So I expect Rybka to play g8=B > in the next version. Several things.. A properly installed Rybka WILL solve the above puzzle. (Using 6 piece table bases). Secondly this is clearly a puzzle, and Rybka is by no means the best puzzle solver. And as I read, it is not likely to make the next version. Maybe consumers shouldn't play games that result in puzzle endings. But more importantly you are making without realizing it, that selective search is somehow "anti-consumer" and therefor bad. I think that is rather bold. Just because you can find a case you construct where selective search fails, doesn't make it, nor correct. There are many many cases that you can probably construct if you knew the selective search pruning rules where you can reliably beat the program, especially if you construct single solution puzzles. None of this makes selective search bad, or the program isn't the strongest. Clearly selective search makes the best move most of the time, especially in non single move (real world) cases.
|
| | | | | |
Date: 12 Mar 2008 13:18:59
From: Wijnand Engelkes
Subject: Re: Generate a list of legal moves (command-line)
|
Rybka can look up this position in a table base, but that's not solving. And I can just add white pawns on a2, a3,a4,a5,a6 and a black pawn to a7 to make it a 12 piece position that is not in the table bases. What worries me is that a programmer would decide to ignore some rules of chess because it makes the program overall stronger. I suspect other hidden flaws then. Would you buy a program that never castles Q-side ?. Just an opening book avoiding all variants where Q-side castling is involved and it will never need castling to the Q-side. Saves valuable computing time and the consumer will be beaten by the program anyway. Sloppy programming? I think so. I would never professionally accept programs designed like that in my company. Rybka is programmed by a very skillful and professional team. Therefore I expect this flaw to be corrected in the next version. "johnny_t" <[email protected] > schreef in bericht news:[email protected]... > Wijnand Engelkes wrote: >> Rybka allows Bishop promotions, but will never promote to Bishop herself. >> White: King h8, pawns g7 and h7 >> Black King e6, Queen g3, Rook b8 >> White is in check and can promote to 4 different pieces. >> Rook and Knight allow Qe5 checkmate >> and promoting to Queen is answered by Kf6 and checkmate next move. >> The only saving move is g8=B, with stalemate or exchanging everything. >> Rybka will never "find" this move by White, but if you play g8=B >> yourself, she will allow it and see the draw. >> >> You extremely seldomly need the move (White's) B f2 takes g1. >> Maybe some program will never consider this move, just to gain speed. >> A consumer product should play by the rules. So I expect Rybka to play >> g8=B in the next version. > > Several things.. A properly installed Rybka WILL solve the above puzzle. > (Using 6 piece table bases). > > Secondly this is clearly a puzzle, and Rybka is by no means the best > puzzle solver. > > And as I read, it is not likely to make the next version. Maybe consumers > shouldn't play games that result in puzzle endings. But more importantly > you are making without realizing it, that selective search is somehow > "anti-consumer" and therefor bad. I think that is rather bold. Just > because you can find a case you construct where selective search fails, > doesn't make it, nor correct. There are many many cases that you can > probably construct if you knew the selective search pruning rules where > you can reliably beat the program, especially if you construct single > solution puzzles. None of this makes selective search bad, or the program > isn't the strongest. Clearly selective search makes the best move most of > the time, especially in non single move (real world) cases.
|
| | | | | | |
Date: 16 Mar 2008 12:23:35
From: David Richerby
Subject: Re: Generate a list of legal moves (command-line)
|
Wijnand Engelkes <[email protected] > wrote: > Would you buy a program that never castles Q-side ?. No but the situation is in no way analogous to a program that never promotes to a bishop. Castling queenside comes up *very* often in practical chess; promotions to bishops are extremely rare. > Sloppy programming? I think so. Not at all. It's optimization for the overwhelmingly more common case in the belief (which, one hopes, has been quantitatively tested) that spending the time searching more promising lines will, overall, increase the strength of the engine, even though it will, once in a blue moon, fail to find a critical bishop promotion. Dave. -- David Richerby Homicidal Slimy Chainsaw (TM): it's www.chiark.greenend.org.uk/~davidr/ like a lethal weapon but it's covered in goo and it wants to kill you!
|
| | | | | | |
Date: 12 Mar 2008 16:28:11
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
Sloppy programming? No, selective search. Please read the below statement. I understand you may not be able to accept selective search as a path to strength. But the professional team at Convekta, and specifically the Rybka programmer does. It is not sloppy, it is an intentional decision. They do make a freebee called winfinder I believe to help you solve your puzzles. Wijnand Engelkes wrote: > Sloppy programming? I think so. I would never professionally accept programs > designed like that in my company. > Rybka is programmed by a very skillful and professional team. Therefore I > expect this flaw to be corrected in the next version. > > "johnny_t" <[email protected]> schreef in bericht >> And as I read, it is not likely to make the next version. Maybe consumers >> shouldn't play games that result in puzzle endings. But more importantly >> you are making without realizing it, that selective search is somehow >> "anti-consumer" and therefor bad. I think that is rather bold. Just >> because you can find a case you construct where selective search fails, >> doesn't make it, nor correct. There are many many cases that you can >> probably construct if you knew the selective search pruning rules where >> you can reliably beat the program, especially if you construct single >> solution puzzles. None of this makes selective search bad, or the program >> isn't the strongest. Clearly selective search makes the best move most of >> the time, especially in non single move (real world) cases. > >
|
| |
Date: 07 Mar 2008 09:40:29
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
tin Brown wrote: > I think you over estimate the time lost here. I haven't made any estimate. The Rybka players estimate that it is a 5-10 ELO difference as I recall. And a testing hit. Not that big of a deal in of itself, but when you are desperately searching for a package of tweaks that is 50-100 points its a pretty big one to leave on the table.
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
|
Date: 05 Mar 2008 21:54:01
From: whystopnow
Subject: Re: Generate a list of legal moves (command-line)
|
On 4, 8:11 pm, johnny_t <[email protected] > wrote: > There are a few projects out there that you should be able to modify to > do what you need. Care to be slightly less mysterious?
|
| |
Date: 06 Mar 2008 17:49:48
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
whystopnow wrote: > On 4, 8:11 pm, johnny_t <[email protected]> wrote: > >> There are a few projects out there that you should be able to modify to >> do what you need. > > Care to be slightly less mysterious? Mostly because I have a lack of personal experience with this precise question. Not a mystery per se. But with black candles and other enchantments I typed the words "Chess Move Generator" into Google, and was amazed by the amount of material nearly 100,000 citations. I think you may find after some clarification here, that your answer may lie there. Good Luck
|
|
Date: 05 Mar 2008 10:37:55
From: fhub
Subject: Re: Generate a list of legal moves (command-line)
|
tin Brown schrieb: > I grant you that situations where under promotion to a bishop is needed > are exceedingly rare in match play, but they do sometimes occur in > puzzles. You=B4re right, but for seriously solving mate puzzle I won=B4t consider using usual chess engine like Shredder, Crafty or any other. They mostly don=B4t give correct (i.e. shortest) mates. E.g. your position above is in fact #12 (and not #14 as Shredder states): ChestUCI Ver.5.0: CPU: Celeron 400MHz FEN: 8/5P1k/4N1p1/6P1/8/p1p5/PpP5/1K6 w - - (6+5) Position-Analysis: C0/R0/K2/P1/X1 W:2/11 Parameters found in Database: #12; 03:26; 00:11 @ C6/R0/K5/P1/X4; Search for Special-Mate [C6/R0/K5/P1/X4] in 12 ... (Hash=3D64MB) 12 00:12 366.608 66.655 +M12 1.f8B Search completed ... (Time=3D11.76s) Mate in 12 found ! (1 Solution in 00:11) 12/12 00:14 850.883 72.353 +M12 1.f8B Kh8 2.Bxa3 Kh7 3.Nf8+ Kg7 4.Bd6 Kf7 5.a3 Kg7 6.a4 Kf7 7.a5 Kg7 8.a6 Kf7 9.a7 Kg7 10.a8Q Kf7 11.Qa7+ Kg8 12.Qh7+ Best move: f8B, Value: +Mate in 12, Depth: 12/12, Time: 00:14,967, 850.883 Nodes, 72.353 N/sec
|
|
Date:
From: Martin Brown
Subject: Re: Generate a list of legal moves (command-line)
|
|
| |
Date: 05 Mar 2008 14:45:35
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
tin Brown wrote: > In message <[email protected]>, johnny_t > <[email protected]> writes >> whystopnow wrote: >>> I'm looking for a tool that will generate a list of legal moves based >>> on reading a list of moves made (like a .PGN). I'd like to interact >>> with it via command-line. Ideally, I'd just say "here's the file" and >>> it would spit out a list of legal moves - it would know whose turn >>> based on the moves so far. >>> I don't see a way to do this with crafty - there's no option to ask it >>> what the legal moves are, though I imagine it wouldn't be hard to edit >>> the code since it obviously has to generate such a list when it >>> plays. Just wondering if anyone knows of something that already does >>> this that is command-line friendly. >>> Thanks! >> >> Many a program's move generator do not make a list of "legal" moves. >> Legality is checked as needed and the branch simply gets pruned out, >> and some programs don't even create all legal moves. Like Rybka >> arguably the strongest program doesn't create bishop promotions for >> instance, because the program would be overall WEAKER if it did. > > That isn't necessarily the case. It fails to find solutions to certain > types of constructed chess puzzle as a result of this decision. And I > can't see that generating the bishop promotion last rather than not at > all would be that much of a performance hit. I quickly constructed the > following position to test this out: > > 8/5P1k/4N1p1/6P1/8/p1p5/PpP5/1K6 w - - 0 1 > > Sure enough Shredder10 finds f8=B #14, so does Crafty19.19 but Rybka > ignores this solution preferring instead to win tediously by gradually > mopping up the pawns. It still thinks f8=N is its best bet even at ply 19. > > I grant you that situations where under promotion to a bishop is needed > are exceedingly rare in match play, but they do sometimes occur in puzzles. >> >> There are a few projects out there that you should be able to modify >> to do what you need. > > Regards, What isn't necessarily the case? The reason that the engine would be weaker, is that this rare case would have to be tested for with every branch that has a pawn promotion. The time spent doing that is time spent NOT looking at more useful things. Meaning that the play will be weaker. But it will fail to find really rare cases that almost never happen in real life or certain puzzles. Some think this is blasphemy others think ELO spent in futile pursuits are wasted ELO.
|
| | |
Date: 06 Mar 2008 15:09:54
From: David Richerby
Subject: Re: Generate a list of legal moves (command-line)
|
johnny_t <[email protected] > wrote: > tin Brown wrote: >> johnny_t <[email protected]> writes >>> Like Rybka arguably the strongest program doesn't create bishop >>> promotions for instance, because the program would be overall >>> WEAKER if it did. >> >> That isn't necessarily the case. It fails to find solutions to >> certain types of constructed chess puzzle as a result of this >> decision. And I can't see that generating the bishop promotion last >> rather than not at all would be that much of a performance hit. > > What isn't necessarily the case? The reason that the engine would > be weaker, is that this rare case would have to be tested for with > every branch that has a pawn promotion. The time spent doing that > is time spent NOT looking at more useful things. Meaning that the > play will be weaker. It is not necessarily the case that the engine will be weaker if it considers bishop promotions. There are two competing factors in ignoring bishop promotions: 1. in some very rare positions, the engine might fail to find the best move (possibly the only winning move) because it doesn't even consider it; 2. the rest of the search should go ever so slightly quicker, which gives it a chance of finding a better move in nearly all positions involving pawn promotion. Taken in isolation, 1 makes the engine weaker and 2 makes it stronger. But, of course, they're not taken in isolation -- both effects occur and the question is which is the more significant. You and Rybka's author believe that 2 is more significant than 1, which means that ignoring the possibility of bishop promotions increases the effective strength of the engine. I would tend to agree with you but, without data, this is just our supposition. It seems likely to me that disregarding bishop promotions increases the effective strength of the engine but it isn't *necessarily* the case. Dave. -- David Richerby Love Apple (TM): it's like a tasty www.chiark.greenend.org.uk/~davidr/ fruit that you can share with someone special!
|
| | | |
Date: 06 Mar 2008 17:45:38
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
David Richerby wrote: > johnny_t <[email protected]> wrote: >> tin Brown wrote: >>> johnny_t <[email protected]> writes >>>> Like Rybka arguably the strongest program doesn't create bishop >>>> promotions for instance, because the program would be overall >>>> WEAKER if it did. >>> That isn't necessarily the case. It fails to find solutions to >>> certain types of constructed chess puzzle as a result of this >>> decision. And I can't see that generating the bishop promotion last >>> rather than not at all would be that much of a performance hit. >> What isn't necessarily the case? The reason that the engine would >> be weaker, is that this rare case would have to be tested for with >> every branch that has a pawn promotion. The time spent doing that >> is time spent NOT looking at more useful things. Meaning that the >> play will be weaker. > > It is not necessarily the case that the engine will be weaker if it > considers bishop promotions. There are two competing factors in > ignoring bishop promotions: > > 1. in some very rare positions, the engine might fail to find the best > move (possibly the only winning move) because it doesn't even > consider it; > > 2. the rest of the search should go ever so slightly quicker, which > gives it a chance of finding a better move in nearly all positions > involving pawn promotion. > > Taken in isolation, 1 makes the engine weaker and 2 makes it > stronger. But, of course, they're not taken in isolation -- both > effects occur and the question is which is the more significant. You > and Rybka's author believe that 2 is more significant than 1, which > means that ignoring the possibility of bishop promotions increases the > effective strength of the engine. > > I would tend to agree with you but, without data, this is just our > supposition. It seems likely to me that disregarding bishop > promotions increases the effective strength of the engine but it isn't > *necessarily* the case. It is a much longer, wordier version that I had compressed into the word "rare". But for sake of completeness we can further examine two words, weaker and rare. And even "I believe". First, I actually do not have a dog in this fight, the whole Rybka issue was solely an "ad computerem" device. They are the strongest program, they don't use all the legal moves. Trying to get an existing engine to create a list of legal moves, while on surface seems obvious and easy cuz aren't they "always" creating a move list in every position. And the answer is suprisingly, most don't. They check legality by implication, and some even ignore otherwise legal moves. Next "rare." The Bishop case is very rare. Namely because the queen also moves diagonally. It would be very rare that a queen would not solve the case, and the bishop would. It has been seen in puzzles, but not in the wild (though I am nowhere near an exhaustive expert on this). What is also interesting, is that in certain parts of the game there is loads and loads of possible pawn promotions and each of them would have to be checked for bishop promotions, if you checked for such things and it would hardly ever, especially in real life matter, and so such things are simply pruned, by implication, from the search tree. By weaker... Everytime you make a decision to prune a tree for whatever reason may mask a deeper truth that would make the program stronger. This is a truism of selective search. But you are making the assumption that the remaining search realm will be more fruitful in the additional depth you are allowed to search in this time frame. This can only be determined by test. And so far Rybka has in any test passed. As it goes forward, there will be advances in evaluation, selectivity and speed of search. This will lead to new balances that will hopefully lead to a stronger engine. This is true for all engines, and computer "play" programs as well. But for brevity, I just packaged all the above into "rare" compared to the time lost. QED Cheers
|
|
Date: 04 Mar 2008 20:11:05
From: johnny_t
Subject: Re: Generate a list of legal moves (command-line)
|
whystopnow wrote: > I'm looking for a tool that will generate a list of legal moves based > on reading a list of moves made (like a .PGN). I'd like to interact > with it via command-line. Ideally, I'd just say "here's the file" and > it would spit out a list of legal moves - it would know whose turn > based on the moves so far. > > I don't see a way to do this with crafty - there's no option to ask it > what the legal moves are, though I imagine it wouldn't be hard to edit > the code since it obviously has to generate such a list when it > plays. Just wondering if anyone knows of something that already does > this that is command-line friendly. > > Thanks! Many a program's move generator do not make a list of "legal" moves. Legality is checked as needed and the branch simply gets pruned out, and some programs don't even create all legal moves. Like Rybka arguably the strongest program doesn't create bishop promotions for instance, because the program would be overall WEAKER if it did. There are a few projects out there that you should be able to modify to do what you need.
|
|