drestebon / papageorge

Simple client for the Free Internet Chess Server
GNU General Public License v3.0
5 stars 1 forks source link

about analysisbot and future tree examine #23

Closed enricoT closed 8 years ago

enricoT commented 8 years ago

:[Game 352] Depth: 12 Score: 8.12 PV: 1. d4 Bxf3 2. Qxf3 Bxd4 3. Nd5 Be5 4. Bxc6+ Nxc6 5. Bxf4 Bxb2 6. Nxc7+ Kf8 7. Bd6+ Nge7 if i click d4 papageorge execute the move, if i play Bxd4 pg try to execute the single move, i would like to run ahead, from actual position it would be nice that papagorge assumption is i play from first move till the move on the list clicked, keeping in memory the sequence and the string from where the move was clicked, so in this case :[Game 352] Depth: 12 Score: 8.12 PV: 1. d4 Bxf3 2. Qxf3 Bxd4 3. Nd5 Be5 4. Bxc6+ Nxc6 5. Bxf4 Bxb2 6. Nxc7+ Kf8 7. Bd6+ Nge7

d4 (clicked) Game 352: AcCoNcIo moves: d4 :[Game 352] Depth: 12 Score: 8.30 PV: 1. ... Bb4 2. O-O Bxc3 3. Bxc6+ Nxc6 4. bxc3 O-O-O 5. Bxf4 Nf6 6. Rb1 Nd5 7. Qd2 Nxf4 8. Qxf4 At this stage i cant it wouldl be nice to click on d4 to go back at precedent move, respecting the string order move, or to jump ahead considering the mouse a pointer of the actual move making possible to jump from to or to go to step by step and going back.

drestebon commented 8 years ago

That is a super cool idea! You will have to have patience on that one thought. We will need to implement a little local engine, and i wanted to wait as long as possible to do that, but it seems just right to do it. It would help us also with the 'late join obsering' issue. On Oct 2, 2015 3:11 PM, "enricoT" notifications@github.com wrote:

It would be nice if i click the move suggested on analysisbot layout, papageorge recognize that is illegal and goes back to the legal in the string console, and execute all the moves (this is preparation to jump on tree analysis board feature in examine) [image: :8ball:]

— Reply to this email directly or view it on GitHub https://github.com/drestebon/papageorge/issues/23.

enricoT commented 8 years ago

This should be the layout for examine as final result or initial in case of uplload from local 1.e4 e5 2.f4 exf4 3.♘f3 ♘f6 4.♘c3 d5 5.e5 ♕e7 Pawn cannot take Knight ( 5...♘g4 ) ( 5...♘h5 ) ( 5...♘e4 6.d4 ♘xc3 ) 6.♕e2 d4 example comment ( 6...♘fd7 example of comment ) * Should be possible to add moves new variations just typing or mousing the board after played on board, to add automatic comment owner should add on server:

This an example lay out from scidvspc Pgn game, where is possible to clickleft to jump on position or menu option on rightclick on comment or move move variation up on first variation level promote variation to main . Is possible to strip comment is possible to delete variation is possible to add a comment

to do upload from local pgn save to pgn local save observer commnts save only owners comments save everything on console during analysis undo last action (ctrl z style)

Nota: scidvspc is not able to examine the game in this way can work on file only on local but is a good point to start the managing of board i suggest to give an eye shot

the serve has only 1 main line, so basically seems that to upload the game you have to send the sequence move by move till move clicked by leftmouse. To use fen means bsetup fen string, setting castling enpassant and tomove color anytime one position is changed + bsetup done command.

drestebon commented 8 years ago

I get it now! I will slowly start working on this. The feature you proposed originally for working with analysisbot has been implemented in 49e80d57e5ccba055583a84c092b320d2005c43a

enricoT commented 8 years ago

if im not in examine mode the feature is not usable, so as user i would not allow to click the analysisbot when observing unless is not on your next enhancemente I have no idea how to jump back from the precedent jump maybe you could add a feature word in console to click to go back. (smartbacward) word to click. I was suggesting to remove the notify server moves when in jump mode when i resized window to see more moves of the list jump ahead featre cause i can see only this: Game 124: AcCoNcIo moves: Qc4

Game 124: AcCoNcIo moves: Nd4

Game 124: AcCoNcIo moves: Bg4

Game 124: AcCoNcIo moves: Qe3

Game 124: AcCoNcIo moves: Qa2+

Game 124: AcCoNcIo moves: Ne2

Game 124: AcCoNcIo moves: Qc4

Game 124: AcCoNcIo moves: Qe7+

Game 124: AcCoNcIo moves: Kh6

When i had a crash:

Qe4+ Qf3 bxc6 Nxc6 Be6 Kf2 Qc4 Nd4 Bg4 Qe3 Qa2+ Ne2 Qc4 Qe7+ Kh6 Restarting Analysisbot in 2 secs ... tell Analysisbot obsme (told Analysisbot) :I will now be observing game 124 and giving you computer analysis. :[Game 124] Depth: 14 Score: 2.16 PV: 1. f5 Bxf5 2. Qxf6 Kh7 3. Nf4 Qa2+ 4. Ke3 Qb1 5. Qxa6 Qg1+ 6. Kd2 Qxg3 7. Qa7+ Kh6 8. Qd4 Qxh4 9. Qh8+ Kg5 10. Qd8+ Kg4 11. Qxh4+ Kxh4 12. Nxd5 Traceback (most recent call last): File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 817, in _glib_idle_callback callback() File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 560, in entering_idle self.draw_screen() File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 575, in draw_screen self.screen.draw_screen(self.screen_size, canvas) File "/usr/lib/python3.4/site-packages/urwid/raw_display.py", line 750, in draw_screen if osb and osb[y] == row: IndexError: list index out of range

After cras h i cant do %q or %c (maybe it was bad idea to try %q before %c)

another crash: After first jump i clicked on seccond move Qd2

I will now be observing game 405 and giving you computer analysis. :[Game 405] Depth: 11 Score: -0.27 PV: 1. Qb6 Qd2+ 2. Kf1 Nd3 3. Bg4 Kg6 4. Qd4 Qc1+ 5. Kg2 Qe1 6. Be6 Qd2+ 7. Kg1 Qxb4 8. Qxb4 Nxb4

e if i understand you sort out of examine jump to move then go back to prevent analysisbot ennoying any move right? (told estebon)

(papageorge:1352): Gtk-CRITICAL **: gtk_main_quit: assertion 'main_loops != NULL' failed and i got crash

enricoT commented 8 years ago

pg assumes that yo u click the latest observed analysis, maybe we need to check that the list clicked is the last layout of the console or that move position on board was played before analysis list click Maybe a boolean LastAnalysis = true, that is set false after move and true after analysis layout could be enough to decide if the move is allowed, then check is the move clicked on latest analysisbot string? Or using latestAnalysis string as boolean cleaned when position change on board, by move of server, then when string is clicked is the string == latestAnalysis? then execute the move, if latestAnalysis is cleaned (by server move) then is different so no move is accepted. Same control to add a jumpback.

This is from trying to play the illegal move 2015-10-07 18:54:22 < b'<12> -------- -p--kb-- p---q-p- P--pnp-p -P-Q-P-P --PK--P- ----B--- -------- W -1 0 0 0 0 0 345 COMPTexel COMPHoudini 2 120 0 18 21 -541 567 77 N/g4-e5 (0:00) Nxe5+ 0 0 0\n' 2015-10-07 18:54:22 < b'\n' 2015-10-07 18:54:22 < b'Game 345: AcCoNcIo moves: Nxe5+\n' 2015-10-07 18:54:22 < b'fics% \n' 2015-10-07 18:54:22 < b'<12> -------- -p--kb-- p---q-p- P--pPp-p -P-Q---P --PK--P- ----B--- -------- B -1 0 0 0 0 0 345 COMPTexel COMPHoudini 2 120 0 18 18 -541 567 77 P/f4-e5 (0:00) fxe5 0 0 0\n' 2015-10-07 18:54:22 < b'\n' 2015-10-07 18:54:22 < b'Game 345: AcCoNcIo moves: fxe5\n' 2015-10-07 18:54:22 < b'fics% \n' 2015-10-07 18:54:22 < b'<12> -------- -p-k-b-- p---q-p- P--pPp-p -P-Q---P --PK--P- ----B--- -------- W -1 0 0 0 0 1 345 COMPTexel COMPHoudini 2 120 0 18 18 -541 567 78 K/e7-d7 (0:00) Kd7 0 0 0\n' 2015-10-07 18:54:22 < b'\n' 2015-10-07 18:54:22 < b'Game 345: AcCoNcIo moves: Kd7\n' 2015-10-07 18:54:27 < b'tell Analysisbot obsme\n' 2015-10-07 18:54:27 < b'fics% \n' 2015-10-07 18:54:27 < b"mattuc(_)(SR)(1): You're welcome.\n" 2015-10-07 18:54:28 < b'fics% (told Analysisbot)\n' 2015-10-07 18:54:28 < b'fics% \n' 2015-10-07 18:54:28 < b':I will now be observing game 345 and giving you computer analysis.\n' 2015-10-07 18:54:30 < b'fics% \n' 2015-10-07 18:54:30 < b':[Game 345] Depth: 13 Score: 1.21 PV: 1. Ke3 Bg8 2. Bf3 Ke8 3. Kf4 Bf7 4. Bg2 Ke7 5. Qc5+ Kd7 6. Bf3 Bg8 7. Qb6 Qxb6 8. axb6\n' 2015-10-07 18:54:34 < b'Kd7\n' 2015-10-07 18:54:34 < b'fics% Illegal move (Kd7).\n' 2015-10-07 18:54:34 < b'\n' 2015-10-07 18:54:34 < b'<12> -------- -p-k-b-- p---q-p- P--pPp-p -P-Q---P --PK--P- ----B--- -------- W -1 0 0 0 0 1 345 COMPTexel COMPHoudini 2 120 0 18 18 -541 567 78 K/e7-d7 (0:00) Kd7 0 0 0\n' 2015-10-07 18:54:37 < b'fxe5\n' 2015-10-07 18:54:37 < b'fics% Illegal move (fxe5).\n' 2015-10-07 18:54:37 < b'\n' 2015-10-07 18:54:37 < b'<12> -------- -p-k-b-- p---q-p- P--pPp-p -P-Q---P --PK--P- ----B--- -------- W -1 0 0 0 0 1 345 COMPTexel COMPHoudini 2 120 0 18 18 -541 567 78 K/e7-d7 (0:00) Kd7 0 0 0\n' 2015-10-07 18:54:40 EXCEPTION IN (/usr/lib/python3.4/site-packages/papageorge/init.py, LINE 47 "cli.connect_mainloop()"): 'Nxe5' is not in list Traceback (most recent call last): File "/usr/lib/python3.4/site-packages/papageorge/init.py", line 47, in run cli.connect_mainloop() File "/usr/lib/python3.4/site-packages/papageorge/cli.py", line 539, in connect_mainloop self.main_loop.run() File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 278, in run self._run() File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 375, in _run self.event_loop.run() File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 847, in run raise exc_info0.with_traceback(exc_info[2]) File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 860, in wrapper return f(_args,**kargs) File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 780, in io_callback callback() File "/usr/lib/python3.4/site-packages/urwid/raw_display.py", line 392, in event_loop, callback, self.get_available_raw_input()) File "/usr/lib/python3.4/site-packages/urwid/raw_display.py", line 492, in parse_input callback(processed, processed_codes) File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 399, in _update self.process_input(keys) File "/usr/lib/python3.4/site-packages/urwid/main_loop.py", line 496, in process_input event, button, col, row, focus=True ): File "/usr/lib/python3.4/site-packages/papageorge/cli.py", line 391, in mouse_event moves = moves[:moves.index(word)+1] ValueError: 'Nxe5' is not in list

drestebon commented 8 years ago

it was more simple than that, moves with a + were not bein properly treated when clicked The "smartjump" has been added to the TODO

enricoT commented 8 years ago

Good perhaps, to check string of latestAnalyze woud be better dont forget that most user are low level if they can mess (if we can mess..) checking that is the latest is less traffic and lag for everyone :)

Using the move command you could strip comments and type this line before analysys bot

  1. d4 f5 2. c4 Nf6 3. Nf3 g6 4. g3 Bg7 5. Bg2 O-O 6. O-O d6 7. Nc3 c6 8. b3 Qa5 9. Qc2 e5 10. dxe5 dxe5 :[Game 84] Depth: 13 Score: -0.54 PV: 1. ... Qg7 2. Ne8 Bc3 3. Nxg7 Bxb4 4. axb4 Kxg7 5. Rd6 Rae8 6. Be4 Rf7 7. Kg2 Bc4

So now you can click on precedent move list and just using command backward you can go back on the list counting the moves between now and clickedtojumpback so basically output could be

  1. d4 f5 2. c4 Nf6 3. Nf3 g6 4. g3 Bg7 5. Bg2 O-O 6. O-O d6 7. Nc3 c6 8. b3 Qa5 9. Qc2 e5 10. dxe5 dxe5 ++ANALYSIS++:[Game 84] Depth: 13 Score: -0.54 PV: 1. ... Qg7 2. Ne8 Bc3 3. Nxg7 Bxb4 4.

Now i imagine clicking with mouse 4. g3 i find first number on right with dot in this case 4. sub 1 multiply *2 and add 1 or 2 according with position of half-move get the position of latest move ontthe board, then latest-clicked so the command to go back could be backward latest-clickedmovenumber

ciao e grazie!

drestebon commented 8 years ago

the check for latest Analyze has been introduced in 20075b79fffd630dd163545ecc622f91b2652fb5

enricoT commented 8 years ago

im watching stoccafisso popperx following and compkomodo-comphoudini wich is analyzed by bot, apparently it doesnt work the analyze feature because there are 2 board observed,even if primary is the analysisbot observed. The lastPosition/lastAnalzed is interfered by board observed nr 2

drestebon commented 8 years ago

does 17061bdea367edab3f8c8231b8a8b6c55bcc8b3a solve this? No moves are issued when you click on them, if you are observing a game. This might be corrected in the future, when we add support for ussing a local engine.

enricoT commented 8 years ago

:+1:

i've meet another problemGame 66: AcCoNcIo moves: a3 :[Game 66] Depth: 12 Score: 0.40 PV: 1. ... d5 2. Bb3 Nf6 3. Nc3 d4 4. Ne2 Bd6

  1. d3 O-O 6. O-O Na6 7. Bg5

Stopping Analysisbot to avoid jamming (told Analysisbot) :All your requests have been removed.

Game 66: AcCoNcIo moves: d5

An error occured sending <<<<<<<<<<<<<<<<------------------------- this message d5 Bb3 Nf6 Nc3 d4 Ne2 Bd6 d3 O-O O-O Na6 Bg5 Restarting Analysisbot in 2 secs ... tell Analysisbot obsme I got this problem sending a pack of moves clicking on Bg5 i wonder if is internal error or just a python internal message.

enricoT commented 8 years ago

i play a3 h6 then:

Game 205: AcCoNcIo moves: h6 :[Game 205] Depth: 14 Score: 0.23 PV: 1. e4 Nf6 2. e5 Nd5 3. Nf3 Nc6 4. Nc3 Nxc3 5. dxc3 d6 6. Bc4 Bg4 7. Qd5 e6

Stopping Analysisbot to avoid jamming (told Analysisbot) :All your requests have been removed.

Game 205: AcCoNcIo moves: e4

An error occured sending e4 Nf6 e5 Nd5 Nf3 Nc6 Nc3 Nxc3 dxc3 d6 Bc4 Bg4 Qd5 e6 Restarting Analysisbot in 2 secs ... tell Analysisbot obsme (told Analysisbot) :I will now be observing game 205 and giving you computer analysis.

i got only e4 as move done, maybe is a problem of waiting for server answer on first move? i got again the freeze problem :(

drestebon commented 8 years ago

This was an interesting one! the problem was in the way the expected message was constructed. Papageorge stored your handle with the case you enter at login, which is different from the case stored in the server, but login is case insensitive!! Anyways, this one commit should have fixed it ;)

enricoT commented 8 years ago

:ok_hand: it would be nice to strip moves echoed by server and print only the latest line from pg: Game 253: AcCoNcIo moves: Rxa8+ (Remove all these)

Nf3 Rc8 Ng5 Kg7 Nxb4 Nxe3 Nxf7 Kg8 Nd6 Rb8 Na6 Rd8 Nc5 Rxd6 Rxa8+ (just print latest to keep a general view on console)

drestebon commented 8 years ago

Incidentally 979561ba1b6082e86f0522982269c204c3db68ee does this

drestebon commented 8 years ago

I believe the general objectives from this discussion have been achieved