Log In  


Cart #solitaire_chess_vol1-1 | 2024-08-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

Solitaire Chess

About

68 solitaire chess puzzles. Drag and drop. Mouse only. Every move must be a capture, no check, king can be captured. Win by leaving only one piece. Lose if no remaining moves and more than one piece.

There are two modes: puzzle rush and relax mode. Relax mode is recommended, but if you get to the end you don't get the winner screen and no points. In relax mode you can navigate to any puzzle by using the selector at top left and clicking "GO". There is no clock or points and progress is not saved.

In puzzle rush mode, points are based on how much time is left when a puzzle is completed. Each failure or reset of puzzle is minus 50 points. You can go negative and progress is saved. Clicking "start fresh" will delete all progress.

Puzzles get harder and have more pieces but also more time as game continues.

Controls

  • left mouse button: select, drag and drop

  • middle mouse button: during game play, press for option button to reset puzzle. (so you don't need to play on when you know you are doomed.) hover and left or right click while holding middle button.
    (You will lose 25 points in puzzle-rush mode doing this).

  • right mouse button: while piece is selected, right click on empty square to deselect piece. Or, while piece is selected, click on capture square to capture (useful to make multiple, consecutive captures without releasing selected piece).

  • menu: reset puzzle or toggle music on/off (each lose modal also has convenient music on/off button).

Credits

4


1

Hey cool cart, I had fun playing. I'm glad you got some use out of my chess code from 9 years ago(!), now I've looked that up I'm going to melt like that gif from raiders of the lost ark. :P


@mrh with the benefit of hindsight and experience, would you do it differently now? In my previous chess carts, I was using a piece-centric table. Your code was the only way I could understand how to determine the valid moves, so I followed your square-centric way of doing things. I didn't before because you have to do a lot of for loops within for loops for the entire board all the time... but it works fine and has many advantages. Anyways, just curious of your thoughts looking back or how you would approach coding a chess game now, 9 years later. (my ultimate goal is to write an engine and I'm getting down all the basics)


1

I had a look back through the code and it wasn't as bad as I feared. I could critique the code somewhat but it's OK. Adding en passant and castling as extra flags on the board state should be a solvable problem.

This is all with the idea that we just need to check the rules of chess for a game as we go. For writing an actual engine you might want to look into more efficient ways of storing a board state as some kind of packed bitmap structure ("bitboard"). Harder to do in Pico-8 Lua but the way to go for a serious chess engine I think. Chess is a very well studied programming problem that I only know a little about, but there's good info online.



[Please log in to post a comment]