Closed LocutusOfPenguin closed 9 years ago
Thanks for reporting! It's great to see all the new different engines with picochess.
Your solution is correct. Usually we would just use arg.split()
instead of arg.split(" ")
, but extra spaces should be allowed in the info string
.
I don't consider it to be good style for an engine to do this, but it should definitely be gracefully allowed.
he also repaired his code. But it can happen anytime...so to fix it on your side would also help. Thanks for yr quick repair.
Quickly included in the bugfix release v0.11.1 :)
on my branch, im already using yr newest&fine V0.11...But its not ready, for release.
But perhaps y can think about (for your lib): get book moves WITHOUT these list of moves (im using my own "weighted_choice" function of it) get all moves WITHOUT these list of moves (increasing list each think-loop => searchmoves decrease).
RIght now, im trying to do it all myself.
Or better for second...instead of searchmoves to uci...tell the engine which moves NOT to think about.
Excellent. I can start working on this Wednesday.
thx. I need that for "alternative move".
something else, y can think about (i know, there are also reasons to not do it). How about "push" returns the board?
In this case i can use the "copy" function even better...like so: game.copy().push(move).fen().split(' ')[0]
Or: get this "split(' ')[0]" out of our code , ha.
Easy ones first: There is Board.board_fen()
with just the setup part of the board. It has been there for a while, but was undocumented until recently.
a secret pearl ;-) I killed almost all ugly splits push is also easy cause only one code line. But the other push's return a move whereas this push returns nothing. Its up to you to decide if nothing is better as board (and not move). I missed it, cause of this nice copy() stuff
Y have an error on readme.rst Its "Performance" not "Peformance"
Just pushed b06c81f6c5b0, adding an optional exclude_moves=() to all the opening book probing methods.
Typo in the big fat title fixed. Went unnoticed there for two years :)
At the moment I don't feel it's right to add a return value to Board.push()
. Not returning anything makes it very clear, that the original board is beeing altered.
That said I do like functional programming, so I may come up with something. In the meantime you can quickly create a helper function to copy then push, if this is a recurring theme.
:-) Without this split the code looking already better, and the Pe_r_formance is also increased. No result, isn't a big deal/problem for me - as said.
Will y also do something on the uci-part for "exclude"?
UCI uses a positive list, instead. I guess you could do:
exclude_moves = set([
chess.Move.from_uci("e2e4")
chess.Move.from_uci("d2d4")])
engine.go(
movetime=1000,
searchmoves=set(board.legal_moves) - exclude_moves)
ok that's possible.
but "weighted_choice" doesn't work.
see (i often get "f7f5" as answer):
board = chess.Board()
board.push_san('f4')
reader = chess.polyglot.open_reader("../books/g-fun.bin")
entry = reader.weighted_choice(board, exclude_moves=[chess.Move.from_uci("f7f5"),chess.Move.from_uci("e7e5")])
print(entry.move())
comparing your and mine code you not included the "exclude" like so:
for entry in self.find_all(board, exclude_moves=exclude_moves))
no?
Correct. Fixed: b4428a8b2e86988.
https://github.com/mAarnos/Hakkapeliitta
producing two spaces after lower/upperbound. see:
depth 10 seldepth 9 score cp 22 upperbound time 17 nodes 48299 nps 2683000 tbhits 0 pv d7d5 e4e5 depth 10 seldepth 9 score cp 14 time 22 nodes 72368 nps 3146000 tbhits 0 pv d7d5 e4e5 d5d4 e2e1 c6c5 f2f4 d8d5 h2h4 d5e4 g1e2 depth 10 seldepth 9 score cp 14 time 28 nodes 101261 nps 3491000 tbhits 0 pv d7d5 e4e5 d5d4 e2e1 c6c5 f2f4 d8d5 h2h4 d5e4 g1e2 depth 11 seldepth 10 score cp 30 lowerbound time 36 nodes 140401 nps 3794000 tbhits 0 pv d7d5 e4e5
That breaks your lib. Im dont know, if two spaces allowed, so i post this issue on both systems ;-)
Im using a "if not token: continue" to solve it right now.