Thank you for bringing a different game genre to the Vectrex.
Having tried to write a chess program many years in the past (in BASIC for a Sony PS2) and ending up with a weak solution, I can really appreciate the complexities of trying to fit any sort of game resembling chess into the Vectrex. Recently, there’s been a Vectrex chess game demonstrated but using an external CPU (Pitrex) to do all the grunt work.
So it is remarkable to see a version of chess that is currently just 13K ROM in size. Considering the Vectrex has less than 1K of useable RAM available, I can really understand the limitations imposed on the programmer.
First off, it’s fitting to hear the national royal anthem!
It is good that there is a calibration screen to allow the player to adjust the pieces on the board. I’m sure this game appears perfect on an emulator, but on the two Vectrex consoles I tested, I do see a waviness of the gridlines. The pieces look static, so I am wondering if there need to be a few more reset0ref()’s between the line drawing points? An alternative is to get rid of the board lines, and put the chequered board on an overlay, this would help with the game goal to draw with optimum frame rate.
The input and chess piece selection is really strong. It is not possible to make an illegal move. It is good that during each calculation of the Vectrex move, a bar is shown giving the status of the move calculation.
Out of all the times, I played Kingslayer Chess I was able to beat it. I think this is understandable because of the limitations of the Vectrex. The limited memory does not allow the Vectrex to have a big look forward at all the possible permutations.
The random move mode is not very entertaining but I’m guessing you implemented this first to test out their chessboard input and output engine. I played mostly "AI 2" mode so far as that was a good compromise between game intelligence and speed of moves. "Deep Thought" mode took a really long time for each move, even against a simple pawn move at the start. Maybe, when I have more time I will try this mode as the title infers the gameplay is likely to be more challenging.
I appreciate this work is an experiment and the programmer was trying out different algorithms. The setup options allow the player to select different gameplay intelligence and it's even possible for the Vectrex to play itself.
Would be nice if there was an option (say button 1) where you could have the option of quitting the game.
Overall, a very good effort for version 0.2! I suspect what appears on the surface is hiding a lot of complex programming aspects underneath. Really enjoyed testing this game.
Last Edit: Jun 5, 2021 7:20:30 GMT -5 by vectrexmad
thank you both for your feedback and for trying out the prototype!
Here are some further explanations regarding the implementation:
The whole thing started out as a performance experiment which only later turned into a playable version of chess. I was primarily interested in how difficult it would be to implement the standard Minimax chess AI algorithm in a way that allows the complete board and all pieces to be kept in view on the Vectrex screen at all times.
Minimax can rather easily (well, sort of…) be implemented by using recursion, but its recursive form makes it unsuitable for the Vectrex's draw-everything-in-each-50Hz-frame requirement. So the fun was to break down Minimax into a state-machine-form that executes one slice of the algorithm in each frame. I deliberately chose not to have the board imprinted on the overlay, but to truly draw it in vector form, just like all the other pieces. That was part of the challenge.
Of course, drawing everything, especially also the board, has a negative impact on the overall performance of the AI computation, as there are only some few 1000 cycles left for this in each frame. The whole experiment is a bit academic in nature and probably of less practical value, but hey, there is a reason why I called my Vectrex lab page "Weird Science"
I have not yet tweaked the Minimax algorithm to make it any smarter. Currently it is just the standard algorithm with a very simple board evaluation function. There are lots of known heuristics I could try to improve this, but I am a lousy chess player myself, so it would be rather hard for me to judge if the program had become any smarter or dumber. I am pretty sure that the program will never be able to beat any serious chess player, no matter what I tried. But I think and hope it will still provide some fun for amateur or novice players, or maybe even for kids who are just about to learn the rules of chess. And for that, I think, it is good to have to board displayed at all times.
I added the "random moves" opponent just for testing purposes, and also because it was fun and easy and cost virtually nothing. Also, I found it quite amusing to watch the other AIs play against it.
There are actually 3 different AIs, corresponding to Minimax levels (depths) 1, 2 and 3:
WOPR– calculate the best move based on the current board situation only
HAL 9000– calculate the best move based on the current board situation while also taking into account all possible subsequent opponent moves
Deep Though – calculate the best move based on the current board situation that allows the best possible next move after any possible subsequent opponent move
What is considered to be "the best move" depends on the board evaluation function. Right now, I am using a rather simple one here which counts the values of the present pieces and also takes into account the grid position of each pieces on the board.
I found that Minimax level 4 just takes too long on 8 bit hardware, even when run with 100% CPU and without any drawing, so I did not add any further AI.
I did not encounter any shaky or wobbling vectors on my console. All vector lists drawn have their proper Reset0Ref(), so I would be interested in learning more about any waviness of the grid lines or any wobbling of the pieces. Especially, if this happen with the default settings, or only after calibrating the screen by means of the setup menu entry.
Some more trivia: The current implementation uses some 350 bytes RAM only (plus some few 30 bytes on the system stack), so there is still a lot of RAM available. The current ROM size of roughly 13K could probably be reduced to, I don’t know, maybe 10K? I have not size-optimized the code in any way and there are several redundant parts in it.
Regarding a possible 0.3 version, I will add a switch-off-the-screen-during-AI-computation mode, so that you can experience the performance of the AI computation at CPU 100% usage. I will probably also try to improve the board evaluation function, to make the AI a bit smarter, but I am afraid that I am too bad at chess myself to really tell.
Thank you, for Kingslayer chess, Peer, which is another nice project which again came out of nowhere. Your above explanations regarding AI and difficulties are quite interesting to read. Personally, I played chess when I was juvenile. I never tried playing on a computer because I find the design of the chessman and view of a virtual chessboard irritating and an extra challenge. Perhaps I should just give it a try and see whether I can beat the AI.
Anyway, I wish you good fun, many "Aha!" experiences and new expertise with this Vectrex project, Peer!
OK, i was giving it a try. Haven't played chess since Battle Chess. Was hoping that WOPR will be about Tic Tac Toe difficulty and thanks Peer. It was fun!!!! White = WOPR
and WOPR did more such moves
OK, i was also lazy but end game looks promising
I love WOPR. I won and found that WOPR was not detecting check by my queen instead moved a pawn. Only had emu for playing but interface was intuitive and easy to use. The symbols are easy to distinguish.
Sorry for screenshots without overlay. Just started playing...
I love WOPR. I won and found that WOPR was not detecting check by my queen instead moved a pawn.
Glad you enjoyed the game!
Yes, WOPR does only compute its own best move based on the present only, and does not take into account any subsequent future opponent moves (Minimax level 1). If you want the AI a tiny bit smarter, then try HAL 9000 (Minimax lelvel 2). But be careful, HAL won't open the pod bay door for you!
PS: Right now I am working on version 0.3, which will have improved performance, and also offer AI 4 - UNIVAC, which will implement Minimax level 4.