Jump to content
IGNORED

Chess


Andrew Davie

Recommended Posts

I've spent the past week or so playing with the awesome PlusCart from @Al_Nafuur and integrating it into my development environment.

 

What I'm trying to show with this video is a build/run cycle in action in glorious blurrycam...
 

 

First, there's the absolutely mind-bogglingly-good Atari Developer Studio environment from @mksmith which has totally changed the game. I love using Visual Studio Code and all that it brings, to develop for the '2600.  So first I show Stella running my game (from the absolutely awesome Stella crew), and then I make a simple change to the program - in this case, enabling "rainbow" mode.

Then I do a keypress/build (option/command/B) and it runs my makefile, does a build via the awesome dasm assembler, and copies the binary to a directory (~/Nextcloud) on my machine. It runs Stella, and meanwhile in the background Nextcloud is uploading the binary to my Pluscart account. It's pretty quick - just a half-second or so - I tried to capture it when I zoomed on that green tick icon up top.

By the way, if you haven't checked out the brand spanking new dasm manual - run, don't walk, to...
https://raw.githubusercontent.com/dasm-assembler/dasm/master/docs/dasm.pdf


So, stella's running the game on my machine, now over to the real Atari 2600. You can see my PlusCart is running chess at the moment - and here I needed to soft-reset (which is joystick-right + RESET press) and it was tricky to do that one handed while filming, so.. shakycam.  Anyway, once I reset there's my Pluscart menu and I select chess.bin (which is hopefully the new one)... and after a bit of a download wait, up it comes.

I have the ability now to build for emulator and test, and while that's happening, it's already basically ready-to-run in my "My ROMs" folder on the actual hardware. I love it.

Edited by Andrew Davie
  • Like 9
Link to comment
Share on other sites

1 hour ago, Andrew Davie said:

Anyway, once I reset there's my Pluscart menu and I select chess.bin (which is hopefully the new one)... and after a bit of a download wait, up it comes.

the directory listing does not reload after an emulation exit, so actually it is the "old" chess.bin that the PlusCart is requesting from the PlusStore. The PlusStore of course only has one file with that name in the directory (the new one) and is serving that file.

 

Replacing a file with a new one without reloading the directory at the PlusCart works, as long as the file size has not been changed.

Edited by Al_Nafuur
Link to comment
Share on other sites

3 hours ago, Andrew Davie said:

Then I do a keypress/build (option/command/B) and it runs my makefile, does a build via the awesome dasm assembler, and copies the binary to a directory (~/Nextcloud) on my machine. It runs Stella, and meanwhile in the background Nextcloud is uploading the binary to my Pluscart account. It's pretty quick - just a half-second or so - I tried to capture it when I zoomed on that green tick icon up top.

 

Awesome setup! :)  I've been dropping files into the PlusCart through the web interface which is also pretty easy, but I think I will add that streamlined option to SuperCharger BASIC for completely automated Development. I think it should be a toggle option though and not stay on with each build.     

Link to comment
Share on other sites

4 hours ago, Al_Nafuur said:

the directory listing does not reload after an emulation exit, so actually it is the "old" chess.bin that the PlusCart is requesting from the PlusStore. The PlusStore of course only has one file with that name in the directory (the new one) and is serving that file.

 

Replacing a file with a new one without reloading the directory at the PlusCart works, as long as the file size has not been changed.

Thanks for the information.

An auto-update of the directory was one of my pending requests anyway.

Link to comment
Share on other sites

14 hours ago, Al_Nafuur said:

the directory listing does not reload after an emulation exit, so actually it is the "old" chess.bin that the PlusCart is requesting from the PlusStore. The PlusStore of course only has one file with that name in the directory (the new one) and is serving that file.

 

Replacing a file with a new one without reloading the directory at the PlusCart works, as long as the file size has not been changed.

 

... and that works just fine for most developers anyway.

  • Like 2
Link to comment
Share on other sites

One thing that I never really liked was that initial screendraw - I would have much preferred the whole board to pop up at once. I was planning to get to that - not as easy as it sounds, although I could probably leave the draw the same and just black out all the colours until it's finished. However, I had a thought - i wonder what it would look like if I drew the board in random order at startup.

And here's the result - first in normal speed, and then in 10% slow-mo.  The black/empty squares are still "drawn", so I can make this twice as quick by not drawing them. I quite like this, actually.

 


Meanwhile.... gonna try manufacturing some some bitCHESS PlusCarts from scratch...

 

bitchesseagle2.thumb.png.2c61287ad8d935f518335cfc2692184e.png

 

 

  • Like 7
Link to comment
Share on other sites

1 hour ago, Andrew Davie said:

One thing that I never really liked was that initial screendraw - I would have much preferred the whole board to pop up at once. I was planning to get to that - not as easy as it sounds, although I could probably leave the draw the same and just black out all the colours until it's finished. However, I had a thought - i wonder what it would look like if I drew the board in random order at startup.

And here's the result - first in normal speed, and then in 10% slow-mo.  The black/empty squares are still "drawn", so I can make this twice as quick by not drawing them. I quite like this, actually.

 

 


Meanwhile.... gonna try manufacturing some some bitCHESS PlusCarts from scratch...

 

bitchesseagle2.thumb.png.2c61287ad8d935f518335cfc2692184e.png

 

 

Quoting for the sheer awesomeness of this.  Totally bitCHIN'

  • Like 1
Link to comment
Share on other sites

Well, the crashing when I expanded the depth of search is now found/fixed.

 

This was an unusual one; esentially I changed the search from 4-ply, 7-quiescent to 4-ply, 8-quiescent was the difference between a running version and a complete crash. And by crash, I mean BSOD crash; nothing at all chess-like on startup. These crashing versions crashed on Stella, they crashed on UnoCart, and they crashed on PlusCart.  Now clearly, this had to be a bug in my program, right?

 

@Thomas Jentzsch started the ball rolling by doing a bit of debugging in Stella and finding an incorrect piece on the board. This was true, but it turned out that all of the pieces on the board were incorrect. This was not, really, possible... and so it pointed to a much deeper issue. I finally found that when I increased RAM size to > 16 KiB, that's when the problem started.  And I began to suspect a bug in Stella... but no, it's also crashing on hardware, so it has to be a bug in my code!

 

Well, to cut a long story short, I did more testing - specifically because I had an old version of Stella on which the program did run OK, and a new version of Stella where it didn't. This was very strange, because there must be something in my program that, despite being incorrect, worked on that one version of Stella (and nothing else).  After posting a bug report on Stella to the effect of "what changed in Stella so whereas that old version worked, now it doesn't?"  -- and Thomas pretty much said I'd have to track down the exact version of Stella that worked, and when it changed.

 

"git bisect" to the rescue. This is an incredibly useful tool. Basically when you check stuff into git, it tags it with a unique 40 character ID.  So it's easy to refer to specific version by just using the ID.  Now the tool git bisect does this. If you pass it two IDs, where your code works for the first but not for the second, then git will do a binary search on the code for you. Basically you iterate through the process of telling git bisect "good" or "bad" as it goes through the versions automatically.  So, essentially... git bisect checks out the correct version for your current check, then you say "good or bad" and then git bisect checks out an earlier or later version based on that. You halve the number of candidates each time, so within (say) 5 or 10 iterations, you find the exact version where something that used to work... no longer works. And you have the ID, so you can use git to look at the exact code changes.

So, I did that... and reported the result on the stella issue - and soon enough Thomas had a look at that version and found the bug. Yep, a bug in Stella after all.

 

But wait -- the >16 KiB version still doesn't work on PlusCart or UnoCart.... so how come?  Well, this is one of the incredibly rare examples where occam's razor did not apply.  The simplest explanation (Occam's razor) was a single point of failure and thus a bug in my code. But there wasn't a bug in my code, because it was a bug in Stella that stopped Stella working.

 

And, it turns out, there's a shared bug in PlusCart/UnoCart 3E+ bankswitch code, that limits RAM to 16 KiB.  That's a bug because the 3E+ scheme actually supports 32 KiB of RAM.  So, that's not quite fixed yet - will take a while to get around to the various releases for those products. But at least now this issue is solved for me, and I can move on with my life.  

This was a very interesting one for me - a "triple" failure, none of which was my actual code.  It highlights the point that "bringing up a new bankswitch scheme" is actually quite frustrating sometimes. Implementation of the scheme requires cooperation across a wave of technologies; your own code, of course, but then Stella for the emulation of the scheme, and of course hardware implementations for the actual realisation of the scheme on hardware. I've seen this several times - originally with the 3E scheme, for example.

Sometimes life on "the bleeding edge" can be fun, sometimes not.

So, here are two binaries - they both have the new "randomised board draw startup" so you can have a look-see at how that works.  The 4P_Q8 just pushes over 16 KiB of RAM, and so will probably fail for you (with your current version of Stella, your UnoCart, or your PlusCart). But it's correct code, and when you get a Stella update with the code fix, or update your firmare on PlusCart/UnoCart once the fix for those is released) you'll be able to run it on hardware, too.  And for those of us who are waiting, there's a version 4P_Q7 which does not exceed 16 KiB of RAM, and thus will run on everything.


 

 

 

 

chess20200911_4PQ7.bin chess20200911_4PQ8_FAIL.bin

  • Like 8
  • Thanks 1
Link to comment
Share on other sites

Regarding bugs in multiple implementations.  Yep, this can sometimes happen, particularly in this case where the code is being shared between projects.  And the fact that the 3E+ scheme is still in flux, partly being developed/refined as this game is being developed.

 

Regarding 'git bisect'.  I really need to look into that one.  I was basically doing that manually, looking at different commit hashes and narrowing down where a bug was introduced.  I had no idea that git had a workflow to do this automatically.  Definitely something I need to look into.

  • Like 1
Link to comment
Share on other sites

14 minutes ago, stephena said:

Regarding 'git bisect'.  I really need to look into that one.  I was basically doing that manually, looking at different commit hashes and narrowing down where a bug was introduced.  I had no idea that git had a workflow to do this automatically.  Definitely something I need to look into.

Ditto. Very handy tip from Andrew! ?

Link to comment
Share on other sites

2 hours ago, zbyti said:

@Andrew Davie

I'm watching Garry Kasparov playing today and I'm wonder if you ever consider give us an option to play Chess960?

 

 

Yes, I have almost decided to start implementing play against online chess engines via PlusCart functions.

It should be relatively easy to do, and totally change the whole thing, really.

But it would be nice to have a functional local (6507) chess engine too.

Link to comment
Share on other sites

14 hours ago, Andrew Davie said:

Well, the crashing when I expanded the depth of search is now found/fixed.

 

Interesting, in this new 20200911 version of the game, i now can also move the cursor again with the controller, when using STELLA V6.0.1. This didn't worked in certain older versions of the game (which i already mentioned before), but now works again. Cool.

Edited by AW127
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...