Chess for Max
Presenting the best Max object you never knew you needed: "uci", filling out the Max feature set with that certain je ne sais quoi which only chess can provide. Years in the making, now immediately available for your personal enjoyment.
– mouse and text move input (short/long algebraic or coordinate notation)
– move verification, check and mate detection, en passant, castling and promotion
– move message output indicating (long) algebraic notation, coordinate notation, ply and move success (validity)
– FEN input/output support
– 17 buttery smooth and expertly centered piece sets
– fonts and colors
– view the board from White or Black’s perspective
– load and configure up to 2 UCI-compatible chess engines — play against yourself, a friend, a computer or let two computers play against one another
– full engine analysis output is available for parsing & evaluation
– 32/64 bit compatible
– Mac & Windows support
– PGN file/database input/output
– Max for Live device for color-coded chess using Ableton’s Push interface
Available in a convenient Max 6.1 Package format @ http://www.expr-i0.net/uci.zip
Thanks in advance for any testing or comments.
Very cool Jeremy!
Am i correct in understanding that pawns on reaching the backboard don’t change to a new piece?
Also, I do not see documentation for the checkboxes available in the options window, so alas I am unsure what those check boxes toggle.
Promotion might have been, eh, overlooked. I've never really played a real game using this thing. :-) En passant capturing is supported, though, I'll fix the promotion bug as soon as possible.
Attached is my options dialog for the Stockfish engine. Yours doesn't look like that?
Yes, Ok, gotcha.
Yes, that’s the image I see.
I just replaced the archive at the location linked above with a version which fixes the promotion bug. Sorry about that.
Note that underpromotion is only available if you type the move in (e.g. c8=N in algebraic or c7c8n in coordinate). Otherwise, you’re getting a queen.
Sooo, if that’s the image you see, those are options for the Stockfish engine and are probably documented on the Stockfish website (http://stockfishchess.org/) — I’m just passing along the stuff that the engine tells me about. Certain options, like MultiPV (to enable more than 1 principle variation in analysis) or Threads (to control processor usage) are fairly widespread. Others are engine-specific, so you have to find the engine documentation to get a good idea of what those things do.
> or let two computers play against one another
singularity is near!
your presentation at CodeControl was very cool :)
– view game score from White's perspective (it's currently relative to the side to move)
– option to output PV in coordinate notation, which is easier to parse and map in Max (see below — very simple LCD rendering of the engine's "thoughts" during the famous game Morphy vs. Anderssen)
It’s so great !
I’d love to test this on windows !!
ha! unbelieveable, love it, can’t wait to try this!
I’ve uploaded a new version to http://www.expr-i0.net/uci_130327.zip .
– changes (hopefully improvements) to UCI engine output parsing, more information now available
– option to display UCI engine score from White’s perspective (so, absolute). On by default.
– option to output UCI engine PVs in coordinate notation (rather than algebraic) to facilitate move parsing. Off by default.
– ensure that running UCI engines are analyzing the position on the board.
– some minor improvements to the help file (particularly in the parsing subpatcher).
LATER (file above was replaced)
– minor fixes to ‘info’ output parsing
– complete rewrite of IPC code to accommodate engines with buffered output. Engine loading is now much faster as a side effect.
– ‘load’ message opens a dialog if no arguments are supplied
– ‘id’ info is reported by the engine (name and author)
– more helpfile fixes (non-multiPV case was missing)
Thanks in advance for testing and feedback!
(below is another stupidly simple rendering, this time World Champion Vishy Anand’s beautiful win as Black over Levon Aronian at this year’s Wijk aan Zee tournament)
(by the way, you can read more about the UCI protocol and download the spec here: http://www.shredderchess.com/chess-info/features/uci-universal-chess-interface.html . It might assist you in writing your own parsing patcher for the data streaming from the uci object, but probably not that much)…
Karpov – Kasparov, 1985, Game 24
I’m seeing a series of fine art prints here, Jeremy. The N greatest chess games ever played.
I’m mostly interested in perfecting my ballpoint pen emulation for the time being, but if any wealthy patrons would like limited edition archival prints, they know where to find me. ;-)
Barring any further bug reports, the version of the object at http://www.expr-i0.net/uci.zip is definitive for now. Getting a Windows version going may take a little while, but that’s what’s next.
i was about to say it, the impressive part of the otherwise ugly image is that it really looks like ballpoint pen.
stupid question– what are those pictures you keep posting? are they the traces of pieces on the chessboard during a game or something more abstract?
Cool! Unfortunately Max gets these errors here when trying to load the engines:
uci: load error: could not execute Macintosh HD:/Applications/Max 6.1/packages/uci/misc/critter-16a
uci: load error: could not execute Macintosh HD:/Applications/Max 6.1/packages/uci/misc/stockfish-231-64
The whole package is in "Macintosh HD:Applications:Max 6.1:packages:uci", read access is granted…
@Terry McDermott: in every position (so after every move played in the game), the UCI chess engine (Critter in this case: http://www.vlasak.biz/critter/ ) starts "thinking" and sends a number of lines of potential future play (principle variations = PV), each with a score (in floating point pawns). The (very simple) patch I made basically draws these PVs (as many as are sent within 2-3 seconds), uses the score to determine a color [more white = in white’s favor, more black = in black’s favor, blue = LCD bug, basically means very much in Black’s favor]… and that’s it. Add a little random jitter to the pen positions and voilà, ballpoint pen sketches.
So the drawings are basically maps of what could have happened after each move. Some of the lines did happen, some didn’t. So it’s slightly more abstract, but not much!
@jko: are you in 32- or 64-bit mode — you can determine that by following the instructions here: http://osxdaily.com/2009/09/07/how-to-tell-if-youre-running-the-32-bit-or-64-bit-kernel-in-mac-os-x-snow-leopard/ ? I just verified that everything loads on a 10.6.8 machine in 64-bit mode.
Here are a few things to try from the Terminal:
> cd /Applications/Max 6.1/packages/uci/misc/
Does the engine execute? If you see something like "Critter v1.6a 64-bit, by Richard Vida" printed, then it worked. Type ‘quit’ to exit the engine. If that didn’t work. Type:
> ls -al
and look at the permissions on the left-hand side of the listing. Mine are "-rwxr-xr-x". If you are missing the ‘x’s, the file isn’t executable for some reason (your unzipper might have trashed them). Try:
> chmod 755 critter-16a
and see if that fixes the problem (for Critter — you’ll have to do the same with Stockfish, of course).
Thanks, let me know what you find. I have a 32-bit 10.6.8 machine kicking around that I can test on, too, if you don’t get any further after trying this stuff out.
It’s the 32 bit kernel. (do you think I should try to switch to the 64 kernel generally? It’s an old machine but it does what I need it to so far…)
Enginge executes with this message:
jkomac:misc jko$ ./critter-16a
Critter v1.6a 64-bit, by Richard Vida
hardware POPCNT disabled
File permissions are good.
Thanks for your help, best, Joerg
BTW: tried to load the Hiarcs Hiarcs13.1SP and the Hiarcs13.1MP as well (I use these here with Sigma), also no success.
@jko, thanks for that.
If you were running the 32-bit kernel, Critter would say "Critter v1.6a 32-bit, by Richard Vida", so I suspect that you are actually running the 64-bit kernel!
I know that HIARCS 13 & 14 both work in 64-bit mode (the changes I made to the IPC in the last version were due to HIARCS’s buffered output, in fact). And I just installed Max and ‘uci’ on my 32-bit 10.6.8 box and could successfully load and run Critter (the version of Stockfish which I put in the archive is 64-bit only, so you’d need to get the 32-bit version from their site). So this is a puzzle.
Is there anything in your Console.app which looks relevant?
@jko: OK, here’s an idea. It might be the spaces in the path names. You could use a packages folder in your user documents folder to test this, so that the path to the file is /Users/jko/Documents/Max/Packages/uci/misc/critter-16a , without any spaces. Please give that a whirl.
Strange: Because I have
Darwin jkomac.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
I’ll be offline for some days now and will get back to you next week. Happy Easter!
Ha, twas the Spaces in the paths! Got it working now, thanks!
Great, I’ll fix that and update the archive. The ‘stat’ tool that I’m using to verify executability is apparently stricter about spaces than the other parts of the IPC chain.
You asked for it… At long last, the Windows version is finally available. :-)
http://www.expr-i0.net/uci.zip now contains 32- and 64-bit Windows binaries, an updated helpfile and some Windows UCI engines to play around with (in addition to an updated Max external). Thanks for checking it out, and please let me know if you run into any trouble. I’m not 100% satisfied with the quality of the images on Windows, so there may still be some changes in that regard, but it should be otherwise feature-equal with the OSX version.
Anyone had a chance to try this out on Windows who cares to lavish praise/indifference/scorn on the project? Like, does it work?
I’m not sure I understand. Windows 32-bit is working for me. But maybe you just mean that the computer beat you. :-) Don’t feel bad — even the free engines provided in the download are tendencially stronger than human grandmasters.
You guess right… i just can not beat max!…max/msp at last takes revenge for all these painful hours of experimentation …Jeremy this object is INCREDIBLE! THANK YOU!
Permission granted! Thanks, Jeremy
Building something to paste in Openings and play Chess by sending moves via email I realized that the back / forward function stops working after a certain count of moves. See attachment. Would be perfect if you look into and see if there is an easy fix (or if it’s just here) before I start building a FEN history by myself….
----------begin_max5_patcher---------- 1123.3oc4XssaaiCD8Y6uhA9YuAhWDEcea+NJJJHontzZKYHImj1h9uuCIkZ bZssrchurnOXFvQjCOygysveLcxLc8y11YvGfOBSl7ioSl3E4DLoe9jYqTOa VpZ8Kalod0JaU2r4gu0YetyKWqLeEdpt4qsygr5lmTMogoCqbspyTTVk+4Fq oKbhIwzGnwyA5hGhvwjX+e3ODAepeSkodkWq+x+PYCZJqtpq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lA72eKAuXho11txJeE2sVi6gY1ZQ Ekoo1ps6SNsr005r2ni14MywBG+QQFAOhqKbFidbcMeOgG9UCNDwcl2C89BO tmD6tBOjiwcN95gmiJ75pAG9wflq2sk3thbVbWgF4EDMgZpp0qez1z1qROPv 1I9RntrXteZYUXpuZN9uI8X4v58MyLS0fcYzgsXroIz8yyRwroty4mS+Omql I8B -----------end_max5_patcher-----------
Thanks for the report. I’ll check this out and get back in the next day or so.
Good find, it’s a tiny little bug in the FEN parser. I’ll push new versions out later today, thanks for helping to track that down.
Wonderfull Jeremy, thanks a lot!
So attached is a maxproj that can do 2 things:
1) we use it to play remote chess by sending moves via mail: Start a new game or paste the move sequence you got into the textedit box. Make your move, it’ll be appended to the text. Copy everything in the textbox and paste it into an email, send, done, wait for reply. If you don’t need to recreate the game you can also just append your move in the mail using the short Notation a1a2. If you paste it in the patch later the parser will tidy it again. (You could also send pgn files but this way it’s very simple to reply without opening the patch if the game is still on your table).
(a co-player told us he played chess in a tournament by sending moves via postcards, 3months timeout for 10 moves – nice)
If you use back forward the textedit field will be cleared not to mix it up completely….
2) Paste in games from wikipedia (eg: http://de.wikipedia.org/wiki/Liste_bekannter_Schachpartien) or whatever. You can basically paste in everything as long as the moves contain start field and end field "11. Qd4xe5??" will work as good as "d4e5", as long as it’s a valid move and there is no spaces inside. "Qe5" will not work! You can paste in a lot of moves at once (text will be ignored, but alternatives not, so just copy the lines that contain real moves). Hit enter or click the button, if it can not be parsed you’ll see the problem move below the board. Use the back forward buttons to see what happened in the game.
You might want to remove the german attribute in the js box in order to output english Shortnames (RBQKN)
If there was still pm-Option I would ask you to challenge me that way but I can’t find it anymore, is it gone?
Have you developed the M4L Device yet ?
Heh, yes I did like 1.5 years ago. No idea if it still works. I’ll get back to you after Max 7 is released
Is M4L device contained in aforementioned zip links ?
No I never released it. I’ll need to find it and clean it up (it was part of a presentation I made in Leicester).
Hi Jeremy, thank you for the wonderful Chess for Max object! Just wondering, does it work with Mira?
That would be a feat. No, I’m afraid there is no Miraified representation of the board. You would need to construct that yourself >>somehow<< (and it doesn’t immediately occur to me, how).
P.S. I found the materials referenced above, will send something out on Monday…
Well, I’ve done it! Head on over to the ‘software’ section of my website (http://www.raphaelradna.com) to download the ‘MIRA Interface for UCI’ Max 6 project. The code is pretty clumsy, but it is working on my devices. If you use it, please feel free to let me know what problems you encounter, or what features you would like to see in an update (I am already thinking about implementing additional tabs that allow for complete UCI configuration, and moves list/analytical readout). I should also mention that I haven’t tried using it with one or more computer players, so I don’t know if that works. Cheers!
That’s so cool! I don’t actually have an iThing to try it out with, but thanks for doing it.
By the way, here’s a test version (OSX only) which supports read/write of PGN game files, among some other refinements and fixes: https://www.dropbox.com/s/c3pddcb0dc8hpn0/uci_150204.zip?dl=0
Once I’m happy with everything and have had a chance to update the Windows objects + the help file + dust off the Push code, I’ll make a new official release. In the meantime, please take it for a spin…
– @shortalgebraic allows switching between long and short algebraic move output (on by default)
– ‘movelist’ message dumps a list of moves in the format ‘movelist <startply#> <moves…>’ from the status outlet
– alias back/forward to prev/next
– fix dataview colors (on Max 7)
– fix validation of pawn moves (some illegal moves were improperly validated)
– PGN support (openpgn <filename>, viewpgn, closepgn, savegame [appends current game to open pgn or creates a new pgn file and writes to it])
Great work but I am unable to see the moves and I am probably not doing something correctly.
I open the patch (in Max 7 first and then Max 6). The board and pieces look great. I click on
[openpgn] to get this game loaded, then I am expecting to click on [next] and [prev] to see the
game pieces move, but this is not happening. Anything that I am obviously missing?
@Jeremy: Hmm…. Looks like the latest supplied ZIP file contains the wrong name of .pgn: the
[message] should read [openpgn CarlsenAnand2014.pgn]. Then the game loads. Do you have a
more recent ZIP or is uci_150204 the latest? Thanks again for this excellent patch.
Forums > Beta