Author Topic: Chess  (Read 22125 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Chess
« Reply #30 on: June 09, 2020, 02:08:06 pm »
Oh hey, I won one and it's on record:
Code: [Select]
[   Human   Comp]
  1 e2e4    b8c6     
  2 c2c3    g8f6     
  3 f2f3    h7h5     
  4 d2d4    h5h4     
  5 g1e2    h8h5     
  6 e2f4    h5a5     
  7 b1d2    b7b6     
  8 d2c4    g7g5     
  9 f4d5    f6d5     
 10 c4a5    c6a5     
 11 e4d5    c7c5     
 12 d5c6    d7c6     
 13 c1g5    d8d5     
 14 g5h4    d5h5     
 15 h4g3    c8f5     
 16 f1a6    f5c8     
 17 a6c8    a8c8     
 18 O-O     h5b5     
 19 f3f4    b5b2     
 20 f1f2    b2c3     
 21 d4d5    e7e5     
 22 d5e6    c8c7     
 23 e6f7+   e8e7     
 24 g3h4+   e7e6     
 25 f4f5+   e6e5     
 26 d1e1+   c3e1+     
 27 a1e1+   e5d4     
 28 f2d2+   d4c3     
 29 e1d1    c7f7     
 30 f5f6    f8c5+     
 31 g1f1    c3b4     
 32 a2a3+   b4a4     
 33 h4f2    f7f6     
 34 f1g1    f6f2     
 35 d2f2    c5f2+     
 36 g1f2    a7a6     
 37 d1d6    b6b5     
 38 g2g4    a4a3     
 39 g4g5    b5b4     
 40 d6d7    b4b3     
 41 d7d3    c6c5     
 42 g5g6    c5c4     
 43 g6g7    c4d3     
 44 g7g8(Q) d3d2     
 45 g8d8    d2d1(Q)   
 46 d8d1    b3b2     
 47 d1b1    a5b3     
 48 f2e2    a6a5     
 49 e2d3    b3c5+     
 50 d3c3    c5a4+     
 51 c3c2    a3b4     
 52 h2h3    b4a3     
 53 h3h4    a4c5     
 54 h4h5    a3a4     
 55 h5h6    a4a3     
 56 h6h7    c5b3     
 57 h7h8(Q) b3a1+     
 58 c2c3    a1c2     
 59 h8f8+   c2b4     
 60 b1b2+   a3a4     
 61 f8e8+   b4c6     
 62 e8c6++           


@Richard Frost  is there a way to playback the file so I can savor the moment?

Also I put the key command notes into separate txt file to view when questions come to me. You could load up such a file when start the game eg this loads my Grin ) Rummy Variation Help file (bn = 1 is an option on setup code)
Code: QB64: [Select]
  1. IF bn = 1 THEN SHELL _DONTWAIT "Grin ) Rummy Variation.txt" 'oh nice! don't have to load and show!
This line puts the Help info into your favorite Editor along with the EXE game, a good use of Windows and you can edit your own notes right in there when you play the game. That's 2 or 3 birds with one stone.

Here is a starter txt, R Frost Chess Help.txt:
Code: QB64: [Select]
  1. ' Tiny numbers at top are:
  2. ' 1) left   - points ahead/behind
  3. ' 2) middle - current time
  4. ' 3) right  - current moves per second
  5. ' 4)        - best moves per second
  6. ' 5)        - total moves computed
  7.  
  8. ' COMMAND$ options:
  9. ' /    - computer plays itself (for screensaver)
  10. ' init - ignore configuration file (recreates on exit)
  11.  
  12. ' Undocumented keys:
  13. ' A   - switch to automatic mode
  14. ' b/w - switch out of automatic mode
  15. ' D   - deep (really slows it down)
  16. ' R   - developer mode toggle (debugging, extra info)
  17. ' v   - show valid moves (appears at top left)
  18. ' x   - test sound
  19. ' X   - kill color file for fresh start
  20. ' z   - show sets
  21. ' Z   - show funny images (pix used as pieces)
  22. ' 0   - darker black squares
  23. ' 2   - random color black squares
  24. ' `   - plasma intensity
  25. ' ~   - graph moves evaluated per second
  26. ' +/- - change piece size (for some sets, and isn't saved)
  27. ' l&r shift - white/gray board
  28.  
  29. ' In menu, but quicker:
  30. ' 1   - random color squares
  31. ' a   - legend
  32. ' d   - display background
  33. ' B   - square border style
  34. ' C   - elapsed time this move
  35. ' f   - file playback
  36. ' g   - plasma off/white squares/all squares
  37. ' S   - change chess Set
  38. ' t   - time of day clock
  39. ' PgUp/PgDn - brightness
  40.  

Oh there is a file playback, f it! cool ;-))

update: first note under file playback: note don't need .alg extension

update 2:
Code: QB64: [Select]
  1. '      Author: rfrost@mail.com
  2. ' Last update: June 8, 2020, 3356 non-blank/comment lines
  3. ' B+ started mod in Desktop\Games 2020-06-09
  4. $EXEICON:'.\chessdat\chess.ico'
  5. _TITLE "Chess"
  6. SHELL _DONTWAIT "R Frost Chess Help.txt" 'B+ mod 2020-06-09 Here is Help file you can edit
  7. ' Tiny numbers at top are:
  8.  

It works!
 
R Frost Chess Help.PNG
« Last Edit: June 09, 2020, 02:44:55 pm by bplus »

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #31 on: June 09, 2020, 02:43:07 pm »
Well, Magnus Carlsen had better look to his laurels, then!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Chess
« Reply #32 on: June 09, 2020, 03:00:01 pm »
Ha the Magnus laurels are probably safe. But who knows get a Chess program that is fun and anticipates your every wish, making practice not seem like work, and you might be seeing Magnum Mark.

(Well if Mark gets anymore Magnum you might be seeing him anyway!) ;-))

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #33 on: June 09, 2020, 03:40:20 pm »
Of course you won.  Anyone without a lobotomy should!

The file playback is a bit hostile in having to type in the filename, eh?  I should pull up a list of
all current .alg files to choose from, and eventually will.  Such a list should be in reverse date
order, I suppose.  Why I haven't done so yet is mainly because I don't know what Windows library
function to call to accomplish it.  I could do it on my own, but people are more familiar with the
Windows file select mechanism.

I use the .alg extension to distinguish them from all other  files, because I like to do a purge of them
sometimes (del ch*.alg).  Great games, or ones that display a problem, I rename to keep. The logging can
be turned off in the menu to reduce directory clutter.  The game is written to disk on exit, so it's ok
to turn on the logging in mid game.

I suppose there should be a key, probably F1, to show the "help" file. Er.  But how? 
1) your way, call an external editor
2) to the console
3) to a seperate window, keeping the board on screen
4) page flip (crude!)
Then there's the issue of show ALL keys, or only useful ones?  Like, who'd want to graph moves per second besides me, or show all pictures?

The Deep option isn't upping plies for all moves, only the top two or three, yet it's STILL too slow to actually use.

Another major fault is that it does not hold back moves that cause stalemate when the power balance ensures checkmate.

I've pretty much hit a dead end in making it smarter, so I'm studying how other programs function to get ideas.  I detest the idea of using an opening book because it'd involve an insane amount of dull work and hundreds of support files. 

Two chess programs have been under 1K.  Not full implementations, of course, but still shocking.  There must be easier (and presumably faster) ways to do things than I am.


It works better if you plug it in.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #34 on: July 22, 2021, 05:22:03 am »
Richard, I am wanting to update the Games entry for Chess to reflect the latest version.

When I load the latest version (Update: July 21, 2021) into QB64 IDE, I get the following error:

LIBRARY not found on line 86 (click here or Ctrl+Shift+G to jump there)
Caused by (or after): DECLARE LIBRARY “.\\chessdat\\mem", 14

Lines 86-88 are:
Declare Library ".\chessdat\mem" ' CPU load tracking, thanks to SMcNeill!
    Function GetCPULoad
End Declare

Any ideas as to how to correct for this error?  I am using v1.5.

Thanks, Qwerkey (Richard)

@Richard Frost
@bplus

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #35 on: July 22, 2021, 03:24:15 pm »
mem.h is in the zip where it should be.  So, my guess is that you're running Linux. 
Zip updated to have the following, but I don't know if mem.h works under Linux.

Code: QB64: [Select]
  1. $If WIN Then
  2.     Declare Library ".\chessdat\mem" ' CPU load tracking, thanks to SMcNeill!
  3.         Function GetCPULoad#
  4.     End Declare
  5.     Declare Library "./chessdat/mem" ' CPU load tracking, thanks to SMcNeill!
  6.     Function GetCPULoad#
  7.     End Declare
  8.  
« Last Edit: July 22, 2021, 04:07:12 pm by Richard Frost »
It works better if you plug it in.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #36 on: July 23, 2021, 05:08:17 am »
Richard, running Windows 10 & mem.h is in the correct folder.  Don't know why this does not work.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Chess
« Reply #37 on: July 23, 2021, 07:03:29 am »
Just rechecked Chess2 package March 2021, from Games board, works fine for me in Windows 10.

Mem.h has to be copied (or moved) to same folder as QB64.exe like all .h files: charset, direntry, falcon, mem, pipecom, strnicmp, timers.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #38 on: July 23, 2021, 07:32:11 am »
@bplus, also going to try Chess2.zip.  See if it works for me.  Thanks

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #39 on: July 23, 2021, 07:50:19 am »
Copying mem.h to QB64 folder works.

Apologies to both.  Will update Games entry.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #40 on: July 23, 2021, 08:59:59 am »
I deleted mem.h from my QB64 folder (where qb64.exe is) and it still compiles and runs
for me.   In an effort to not clutter up a main folder too much, I put it in the subfolder chessdat
and declare it as .\chessdat\mem.h

This works for me but not others?  Wut?  It's such a small file that I could put it in both.
Should I?


It works better if you plug it in.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Chess
« Reply #41 on: July 23, 2021, 03:03:06 pm »
OK I am really getting confused!

I am only checking the Games Board post and that Qwerkey tells me is still the old Chess2 package that I put in there as Chess2 reply for March 2021 update (gone now).

So I am not checking anything new, just same old under new chess not chess2 name.

@Richard Frost I will double check Qwerkey new code update in Games when he gets to it. For me, h files in QB64 folder is no problem, I copy/paste all of them together when QB64 is updated.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #42 on: July 24, 2021, 08:31:22 pm »
Latest version...
* chess.7z (Filesize: 5.69 MB, Downloads: 255)
It works better if you plug it in.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #43 on: July 25, 2021, 06:33:56 am »
@Richard Frost @bplus Games entry updated to latest version.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Chess
« Reply #44 on: July 25, 2021, 11:35:13 am »
Hi @Richard Frost,

Just checked new zip from Games. Wow that is massive complex of files. Recommend File Manifest or at least a Readme.txt for the package.