Author Topic: Chess  (Read 5699 times)

Kopecjay

  • Full Member
  • ***
  • Posts: 207
Chess
« on: September 09, 2012, 11:03:19 am »
Source code

Play begins with human as white against the minimax engine. Choose new game to select color, or select both to play human vs human.

Board and piece icons used have been created by Peter Wong (virtualpieces.net ).
Latest version uses Minimax written for qb4.5 by Dieter Steinwender and Chrilly Donninger.
Menu library by TerryRichie.

Link to latest version:

https://dl.dropbox.com/u/105214643/chesswolf.zip

Feedback and bug reports most welcome.
« Last Edit: November 18, 2012, 11:26:29 am by Kopecjay »

Clippy

  • Hero Member
  • *****
  • Posts: 19399
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
Re: Chess
« Reply #1 on: September 09, 2012, 11:09:57 am »
You have to use _RGB or _RGB32 colors.

Check out the example: http://qb64.net/wiki/index.php?title=RGB
« Last Edit: September 09, 2012, 11:42:21 am by Clippy »
QB64 WIKI: Main Page
Download Q-Basics Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
QB64 SDL

OlDosLover

  • Moderator
  • Hero Member
  • *****
  • Posts: 5321
  • OlDosLover
Re: Chess
« Reply #2 on: September 11, 2012, 08:15:16 am »
Hi all,
    Downloaded the exe , extracted and ran it. Invalid handle line 12! It would be best to include the image files into the zip file so others can load them.
OlDosLover.

Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: Chess
« Reply #3 on: September 11, 2012, 09:01:17 am »
The image files are in the zip. Are you extracting with full paths?

Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: Chess
« Reply #4 on: September 11, 2012, 09:50:07 am »
Missing DLLs could also produce a similar error (ie if the jpeg.dll wasn't there it 'd give the same error you posted and another dll is needed for png files).

I made a new zip that I believe includes all the needed DLLs and the image files again. The images should be in a folder named chessgui (and the pieces in a subfolder named pieces), not in the same folder as the exe.

The new zip contains a new compiled exe that should adress two of problems I mentioned in my op - pawns should capture correctly at all times and the game should properly end with checkmate (technically, it will also announce checkmate in case of stalemate).
I 've also been trying to implement a simple minimax search for evaluating positions but the program hangs after ~6800 calls to it. So for now it still uses a silly ai picking moves at random.

edit: latest version now in original post

« Last Edit: September 12, 2012, 08:59:51 am by Kopecjay »

OlDosLover

  • Moderator
  • Hero Member
  • *****
  • Posts: 5321
  • OlDosLover
Re: Chess
« Reply #5 on: September 12, 2012, 08:12:10 am »
Hi all,
    Indeed you were correct. For some reason it was extracted to a \chessgui\chessgui folder configuration. Corrected that and it does load and run ok. Will play over the new version and report back to you of any inconsistencies. Good start for a chess program by the way!
OlDosLover.


Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: Chess
« Reply #6 on: September 12, 2012, 08:29:51 am »
Thanks. Meanwhile I noticed another bug which allowed pawns to double advance over other pieces in their first move - and remove the piece in the process. I corrected that and compiled a new exe - attached to edited first post. I also commented out a few commands that would try to print to the console - which I 've disabled and would produce errors otherwise.

OlDosLover

  • Moderator
  • Hero Member
  • *****
  • Posts: 5321
  • OlDosLover
Re: Chess
« Reply #7 on: September 12, 2012, 08:31:24 am »
Hi all,
     I noticed an oddity. The black queen side Knight often turns into a black pawn once left the back line. It does this on the next move.
OlDosLover.

OlDosLover

  • Moderator
  • Hero Member
  • *****
  • Posts: 5321
  • OlDosLover
Re: Chess
« Reply #8 on: September 12, 2012, 08:37:29 am »
Hi all,
    Downloaded the "latest.zip" and the behaviour i described seems to be gone!
OlDosLover.

OlDosLover

  • Moderator
  • Hero Member
  • *****
  • Posts: 5321
  • OlDosLover
Re: Chess
« Reply #9 on: September 12, 2012, 08:44:13 am »
Hi all,
    May i suggest that you removew the older zip files and replace them with one new updated one. Could you also place into this new zip the updated source file plz.
Alternatively use a "001" on each new zip file to indicate the changes if that would be easier plz.
OlDosLover.

Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: Chess
« Reply #10 on: September 12, 2012, 08:50:23 am »
Ok, what I 've done is attached two versions in the original post for now - both are the latest, one lets you play against ai, the other lets you play both sides. That should make it easier to replicate any problematic situations.

Regarding the source, I do plan to post it and probably include it with the zips. Currently though it's littered with consoleprints while I 'm trying to create a true AI and I 'm hoping I can get that right before posting. Not sure when that 'll be, because I 'm also busy coding something else.

OlDosLover

  • Moderator
  • Hero Member
  • *****
  • Posts: 5321
  • OlDosLover
Re: Chess
« Reply #11 on: September 12, 2012, 08:52:16 am »
Hi all,
    Ok, np.
OlDosLover.

OlDosLover

  • Moderator
  • Hero Member
  • *****
  • Posts: 5321
  • OlDosLover
Re: Chess
« Reply #12 on: September 12, 2012, 09:03:15 am »
Hi all,
    The chess with ai seems as stupid as the non ai edition , respectfully.
OlDosLover.

Kopecjay

  • Full Member
  • ***
  • Posts: 207
Re: Chess
« Reply #13 on: September 12, 2012, 09:50:54 am »
Yea it's still picking moves at random. 'Chess with no ai' should let you play both white and black instead. I'll rename one exe so you can extract both in same folder without overwriting the other.

Better yet, I 'm gonna make a new one that lets you pick at start.

Omega

  • Sr. Member
  • ****
  • Posts: 406
  • Path finding making a mockery of me..
    • Recall site..
Re: Chess
« Reply #14 on: September 13, 2012, 07:56:52 am »
Cool.
Bad AI.. but cool.

I always wanted to write a chess chat board.
There would be 2 teams, and a infinite amount players per team.
Each team votes for the best chess move, after 60 seconds it times out and the best voted for move is chosen.
Then as the normal rules are the next team gets to vote.

Just a old idea I had a few years ago.
I thought would be cool.

-https://sites.google.com/site/vrtronics/

 home of ceberon-