Author Topic: Chess  (Read 22146 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #15 on: May 17, 2020, 01:14:32 pm »
1) Added bas file to zip.

2) I've never seen the program do what's in that video.  Are you running Linux or Mac?  What version of QB64 did
you compile with?      Even if I hold down a mouse button I cannot recreate that error (normal procedure is to click
what, then where). 

3) Fullscreen should be achieved in the usual way, with Alt-Enter, and the setting remembered between sessions.

4) May I know how you captured that video?  That's a feaure I miss from ye olde DOSBox.   
« Last Edit: May 17, 2020, 01:25:35 pm by Richard Frost »
It works better if you plug it in.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #16 on: May 18, 2020, 04:06:22 am »
Problem with piece sticking to cursor even after move complete fixed.  Ashish tested it.
I still never saw the problem on my system, so I had to guess at a fix.  Maybe my mouse
driver has debouncing, eh?
It works better if you plug it in.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #17 on: May 18, 2020, 06:10:42 am »
Problem with piece sticking to cursor even after move complete fixed.

@Richard Frost Oh good.  We can consider this excellent program for Games.  The video capture is done with Freeware EasyScreen (readily available).

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #18 on: May 18, 2020, 07:01:20 am »
@Richard Frost I regret that it's still sticking on my machine (it does it on two different machines, one with Mouse, one with Touchpad/buttons, Windows 7 64-bit & 32-bit).
« Last Edit: May 19, 2020, 03:56:33 am by Qwerkey »

Offline QBExile

  • Newbie
  • Posts: 9
    • View Profile
Re: Chess
« Reply #19 on: May 19, 2020, 03:27:11 am »
I also have problems with pieces sticking to the mouse cursor. I have NO problems using the keyboard. Very nice piece of code and plays moderately well. I played a games against the Chess program in the samples section against your program and yours won comprehensively.

This program could use sounds and captured piece display along with a file of all game moves , etc! This is an impressive attempt at a decent chess program and i really like it.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #20 on: May 19, 2020, 09:09:31 pm »
Program does have sound, which I usually turn off.   It's in the Setup menu.

History of moves can be shown with Mode.  Other items in that "extra info"
mode can be toggled with capital T, W, L, or P, as the heading suggests.

Mode varies according to whether the program is fullscreen or not.  If NOT
in fullscreen, pressing "m" toggles thru three settings - screen centered,
screen top right, then the extra info screen. 

Ain't that tiny number at top right a hoot?  It shows how many moves have
been looked at for the current game.  Most games hit more than 50 million.
The preceeding two numbers indicate moves calculated per second, and
best moves per second.   I'm averaging 100,000 moves per second, and
that's compiled for 32 bit.   MPS is also shown on a graph (~). 

The tiny number at far left, if present, tells how far ahead or behind you are,
point-wise.  I rate the Queen as a 9.  There isn't room to display captured
pieces....unless I move to a bigger screen. Is it worth it?  Rather fun to keep
a small window so one can do other stuff while playing.  Also good to keep
the clutter down. 

If you don't like the extra info (including console), change line 78 to "dev =0",
or press shift-r.
« Last Edit: May 19, 2020, 09:36:47 pm by Richard Frost »
It works better if you plug it in.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #21 on: June 04, 2020, 04:19:35 am »
I keep updating it, and uploading a new zip.

I found a chess program on another site that Bplus and Tempodibasic were collaborating on
three years ago.  It's smarter AND faster than mine.  It'll have to study it a long time before
I understand it.  Mine looks nicer, and has more options (takeback, setup, graphics options),
but it's dumb and slower.  WHY is mine slower?  Mainly, I suspect, because I'm using strings
(A-H) to make the code easier to understand, and having to convert to and from these
characters often.

My current version says enemy pawns can control empty squares between a King and Rook,
and disallows castling accordingly. 

I dumped all the console info because it wasn't very useful.  Now the only difference between
regular and development mode is a delay in non-dev mode for computer vs. computer play.
This delay should ensure enough time for the CPU to cool down so that your computer doesn't
go into thermal shutdown, which is still a problem for me if I'm also using Chrome on some
websites.

« Last Edit: June 04, 2020, 06:00:39 am by Richard Frost »
It works better if you plug it in.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #22 on: June 04, 2020, 05:35:14 am »
My current version says enemy pawns can control empty squares between a King and Rook,
and disallows castling accordingly. 
That is as it should be, I think.

I keep updating it, and uploading a new zip.
The librarians will keep updating the Games version on an occasional basis to keep up.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #23 on: June 04, 2020, 02:47:01 pm »
Er.  Hwat?  It isn't in Games.

I suppose it's stable enough to go there.

<kablooie!> 

What was that noise?


It works better if you plug it in.

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #24 on: June 04, 2020, 05:21:19 pm »
Er.  Hwat?  It isn't in Games.
Oops!  Getting slightly ahead of myself!

Offline Qwerkey

  • Forum Resident
  • Posts: 755
    • View Profile
Re: Chess
« Reply #25 on: June 07, 2020, 11:24:27 am »
@Richard Frost I've just played your program against Chessmaster 9000 Extreme Novice player, and yours (nearly) won.  That's the good news.  The bad news is that it missed a 2-move mate and instead produced a Stalemate move.  Whilst you are looking into bplus and Tempo's version, an improved (but not slower) AI would be a benefit, if possible.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #26 on: June 07, 2020, 10:54:18 pm »
Yes, my program has a long way to go in the smarts department.  I often see daft moves.  The primary way to be "smarter" is to look deeper, which it can do but adding two plies means it  thinks for 6+ minutes per move, which I find unacceptable.  The
code may be difficult to understand when I remove all the strings from the main processing in TryMove, which may boost the
speed a lot. 

Most of the code is dealing with graphics and extras, and there's a lot to show what's going on to make further development easier.

It's a program I may be working on for years. Already I'm getting a bit tired of it!
It works better if you plug it in.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Chess
« Reply #27 on: June 07, 2020, 11:31:43 pm »
Well before going for faster or deeper, make sure it plays right. TempodiBasic and my effort started with the QB sample program and we could never get the thing to work right when King was in check. We hacked a number of things like switching AI from Back to White, castling, pawn promotion... but the King under check situation, yikes! The bells and whistles are easy in comparison.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Chess
« Reply #28 on: June 08, 2020, 04:10:20 am »
I quite agree legal play is the first priority. I'm pretty sure it's got that - en passant,  castling, and handling being in check. 

I wasn't aware that your old program had a major deficiency. When I play it I tend to lose a major piece early and give up.
A takeback feature in it would sure be nice.

I've just noticed, by modifying the initial start board, that yours also has no clue what to do in the endgame with just a rook.
Darn difficult thing to put into code, isn't it?  My initial attempt "sort of" works in that it brings a computer-computer game to a
conclusion usually in less than 100 moves. That's one of the benefits of my saving all the games - I can run statistics on them.

« Last Edit: June 08, 2020, 04:11:38 am by Richard Frost »
It works better if you plug it in.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Chess
« Reply #29 on: June 09, 2020, 12:22:18 pm »
Hi @Richard Frost

Since your assurance that all legal moves are working, I gave your game another test last night.

Man! that is a sharp looking setup, love what you've done with the plasma!

And man, am I rusty! I couldn't even get into position to put the AI King into check!

Oh well, practice makes perfect. I will be practicing with your game now, thanks.