Chess for Max

    Mar 25 2013 | 11:51 pm
    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.
    Features: - 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 - coordinates - 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
    Coming "soon": - 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 @
    Thanks in advance for any testing or comments.

    • Mar 26 2013 | 12:13 am
      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.
    • Mar 26 2013 | 12:18 am
      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?
      Best, Jeremy
    • Mar 26 2013 | 12:37 am
      Yes, Ok, gotcha.
      -- Yes, that's the image I see.
    • Mar 26 2013 | 12:56 am
      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 ( -- 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.
    • Mar 26 2013 | 8:37 am
      > or let two computers play against one another
      singularity is near!
    • Mar 26 2013 | 9:15 am
      hey your presentation at CodeControl was very cool :)
    • Mar 26 2013 | 12:02 pm
      bravo !
    • Mar 26 2013 | 2:31 pm
      Coming soon: - 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)
    • Mar 26 2013 | 6:12 pm
      It's so great ! I'd love to test this on windows !!
    • Mar 26 2013 | 10:31 pm
      ha! unbelieveable, love it, can't wait to try this!
    • Mar 27 2013 | 12:14 am
      I've uploaded a new version to .
      - 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: . It might assist you in writing your own parsing patcher for the data streaming from the uci object, but probably not that much)...
    • Mar 27 2013 | 10:45 pm
      Karpov - Kasparov, 1985, Game 24
    • Mar 27 2013 | 11:33 pm
      I'm seeing a series of fine art prints here, Jeremy. The N greatest chess games ever played.
    • Mar 28 2013 | 8:08 am
      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 is definitive for now. Getting a Windows version going may take a little while, but that's what's next.
      Best, Jeremy
    • Mar 29 2013 | 12:17 am
      i was about to say it, the impressive part of the otherwise ugly image is that it really looks like ballpoint pen.
    • Mar 29 2013 | 2:13 am
      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?
    • Mar 29 2013 | 9:32 am
      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... Max 6.1 Osx 10.6.8
    • Mar 29 2013 | 9:40 am
      @Terry McDermott: in every position (so after every move played in the game), the UCI chess engine (Critter in this case: ) 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!
      Best, Jeremy
    • Mar 29 2013 | 10:27 am
      @jko: are you in 32- or 64-bit mode -- you can determine that by following the instructions here: ? 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/ > ./critter-16a
      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.
      Best, Jeremy
    • Mar 29 2013 | 10:46 am
      Hi Jeremy
      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
    • Mar 29 2013 | 10:50 am
      BTW: tried to load the Hiarcs Hiarcs13.1SP and the Hiarcs13.1MP as well (I use these here with Sigma), also no success.
    • Mar 29 2013 | 11:08 am
      @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 which looks relevant?
      Thanks, Jeremy
    • Mar 29 2013 | 11:27 am
      @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.
    • Mar 29 2013 | 11:27 am
      Strange: Because I have
      uname -a 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!
    • Mar 29 2013 | 11:35 am
      Ha, twas the Spaces in the paths! Got it working now, thanks!
    • Mar 29 2013 | 11:39 am
      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.
      Thanks, Jeremy
    • Mar 29 2013 | 2:19 pm
      OK, a general fix for paths containing spaces is now included in the object at
      Thanks for helping me find that (embarrassing) problem, Jeremy
    • Apr 03 2013 | 11:50 pm
      You asked for it... At long last, the Windows version is finally available. :-) 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.
      Best, Jeremy
    • Apr 20 2013 | 9:22 am
      Anyone had a chance to try this out on Windows who cares to lavish praise/indifference/scorn on the project? Like, does it work?
    • Apr 20 2013 | 12:04 pm
      oh...i loose!
      (win 32bit)
    • Apr 20 2013 | 1:10 pm
      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.
    • Apr 20 2013 | 8:05 pm
      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!
    • Apr 24 2013 | 9:09 pm
      Jeremy, hope you don't mind, I added the package to my new Max Package Downloader ( For easy download and update from within max !
    • Apr 25 2013 | 6:06 am
      Permission granted! Thanks, Jeremy
    • Jun 03 2013 | 7:37 pm
      Hi 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.... Best, Joerg
    • Jun 03 2013 | 10:21 pm
      Thanks for the report. I'll check this out and get back in the next day or so.
    • Jun 04 2013 | 6:45 am
      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.
    • Jun 04 2013 | 10:20 am
      Updated package is now available here.
    • Jun 04 2013 | 12:39 pm
      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: 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?
    • Nov 03 2014 | 3:28 pm
      Hi Jeremy, Have you developed the M4L Device yet ? Thanks, JHD
    • Nov 03 2014 | 3:34 pm
      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
    • Nov 03 2014 | 4:21 pm
      Is M4L device contained in aforementioned zip links ?
    • Nov 03 2014 | 9:01 pm
      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).
    • Nov 29 2014 | 1:19 am
      Hi Jeremy, thank you for the wonderful Chess for Max object! Just wondering, does it work with Mira?
    • Nov 29 2014 | 10:14 am
      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...
      Best, Jeremy
    • Jan 16 2015 | 10:15 pm
      Well, I've done it! Head on over to the 'software' section of my website ( 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!
    • Feb 03 2015 | 12:05 pm
      That's so cool! I don't actually have an iThing to try it out with, but thanks for doing it.
    • Feb 04 2015 | 8:56 am
      By the way, here's a test version (OSX only) which supports read/write of PGN game files, among some other refinements and fixes:
      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 ' 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 , viewpgn, closepgn, savegame [appends current game to open pgn or creates a new pgn file and writes to it])
    • Oct 09 2015 | 2:17 pm
      @Jeremy 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?
    • Oct 09 2015 | 2:22 pm
      @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.
    • Dec 09 2015 | 6:24 am
      Hi Jeremy - checking back in a year + later (post Max 7 release) on the M4L device. Any plans to release this ? Thanks, JHD
    • Dec 09 2015 | 8:43 am
      I am a naughty monkey. I'll post something today, whether it works or not. :-)
    • Dec 10 2015 | 4:58 am
      You have 2 minutes left (EST)
    • Dec 10 2015 | 5:18 am
      Well, to be fair, he did post something today....
    • Dec 10 2015 | 9:10 am
      SEE NEXT POST, THIS ONE IS OUTDATED OK, attached is an amxd + js file which at one point allowed you to use your Push (1) as a chess board, using colors to identify the pieces. You'll need the latest UCI object ( , **which I just updated, by the way, I have no recollection whether there are new features, looks like some sundry bugfixes**) and probably some amount of help from your deity of choice. I have not tested this, but obviously I couldn't bear the weight of public pressure any longer.
      If you get it working, please drop a note and post any fixes. I'll try to spin some of this up myself in the next 48 hours and see if it does anything anymore, and whether it works on a Push 2...
    • Dec 11 2015 | 2:41 pm
      Following up, everything still works just fine on Push 1. I've updated the archive at to include the .amxd + .js files. Push 2 is not currently working due to changes in the LCD + pad color specs, so I'll need to get additional information from the colleagues at Ableton.
    • Dec 11 2015 | 3:19 pm
      Thanks so much Jeremy ! I'll check it out with my Push 1 today ! Any tips / links on how to how to install / properly implement the UCI object on OSX 10.10.5 ? Looks like the stockfish install files are all .exe. Is this windows only ?
    • Dec 11 2015 | 3:21 pm
      Place the 'uci' folder in "~/Documents/Max 7/Packages/", which will put everything you need in the search path. There are Stockfish and Critter binaries for OSX (64-bit) in the 'misc' folder.
    • Dec 14 2015 | 2:14 am
      plus a Push 1 which seems to perhaps be lit-up to display an in-process game (?)
      Looked at the .js file and wasn't able to make much sense of it.
      Any tips on where to go from here ? Should the black .jit window be showing the game or chessboard ?
      How would, for example, start a new game from here ?
      Thanks for all your help, it's much appreciated. best, JH
    • Dec 14 2015 | 9:52 am
      The version in the latest package removes the jit.window (this was there because I used the device during a presentation and needed to have a camera attached). So you can ignore that.
      On the Push itself, you should be all set up for a new game after you press the "fen" and "settitle" message boxes.
    • Dec 29 2015 | 12:05 am
      Pushed the fen and settitle buttons. no dice. LEDs on Push remain the same. Push looks like this: Suggestions ?
    • Mar 29 2017 | 12:38 am
      Hi Jeremy, assuming there's not a Push 2 M4L device yet ? I am hoping to load PGN versions of chess matches (or simply enter moves in manually into the Max Chess patch and then have each move output a MIDI note value to the corresponding chess square (A1, B3 etc.) on PUSH 2's 64 pads grid. Thoughts on where to start ? Thanks! JHD
    • May 06 2017 | 10:57 pm
      I ended up here because I'm interested in doing a project involved chess programming in Max. I've seen this post is several years old and I don't know whether this is maintained any longer, however I have some questions that might be useful for my project:
      - Is there any way to query the object to ask them for the presence or not of a certain piece, without having to parse the FEN output. Like "output e8" outputs "black king"
      - Is there any way to know all the possible legal moves beforehand, without actually performing the move and checking it's success or not? This would be useful, for example, for check status, or pieces that are menaced, etc.
      - I would like to note that, if performing "en passant" and going back, if you perform "en passant" again, you can move the pawn but the captured opossite pawn isn't captured.
      Thank you!
    • May 08 2017 | 8:54 am
      I'm not actively maintaining the object, but I certainly haven't abandoned it.
      #1: nice idea, I'll think about it
      #2: also possible: I could output a list of possible moves (internally it would have to try everything, but no reason to make you do that)
      #3: ooh, a bug! I'll fix it when I have a sec. Thank you for the report.
    • Jul 15 2017 | 2:25 pm
      Checking back in. I've had a bad cold, always a good chance to catch up on rainy-day stuff. #3 is fixed, nice bug, thanks.
      #2 is implemented -- basically I am just sending out a list of moves in coord notation (e.g. legalmoves b1d2 b1a3 b1c3 c1d2 c1e3 c1f4 c1g5 c1h6 d1d2 d1d3 d1d4 e1d2 g1f3 g1h3 a2a3 a2a4 b2b3 b2b4 c2c3 c2c4 e2e3 e2e4 f2f3 f2f4 g2g3 g2g4 h2h3 h2h4 d5d6 d5e6), not sure how useful that really is on balance, but I guess it's better than nothing.
      #1 isn't done, I guess I'll do it both ways, your way and the reverse -- you input N (or maybe 'wn' and get any coords where a white knight is, you input r ('br'?) and get black rooks.
      I'll post an update soonish.
    • Jul 15 2017 | 3:20 pm
      For some reason, I haven't seen your reply in May. Meanwhile, I've been using your object as a UI and recreated the chess logic in paralell in a Python server, which sends back a FEN string to update the UI. That's more flexible for the kind of work I want to do. However, I haven't been able to recreate the legal moves, so your update will be more than welcome to me. I've been able to recreate in Python the behaviour of #1 in both ways. I haven't been able yet to recreate legal moves (only pseudo-legal) nor check for check or checkmate status.
      Thank you for your effort!
    • Jul 15 2017 | 4:08 pm
      Alright, give it a shot (same location: The help file needs a general overhaul and I've been meaning to revisit the miserable Push stuff again, so this just updates the binaries. Quick documentation of the additions:
      - 'legalmoves' will report all legal moves from the rightmost outlet as the symbol 'legalmoves' followed by a list of coordinates. Use 'legalmoves 1' if you want algebraic. - 'pieceat <coord>' will report the piece at the provided coordinate (a1-h8). Pieces are denoted by a two-character name [w|b][k|q|r|b|n|p]. So the black king is 'bk' and a white pawn is 'wp'. If no piece is at the coordinate, 'none' will be returned. The output looks like 'pieceat <coord> <piecename>' (repeating the input and adding the piecename). - 'coordsfor <piecename>' will report any coordinates occupied by the provided piece (piece names as above, e.g. 'bb' or 'wn'). Again, 'none' is used for a miss. The output is 'coordsfor <piecename> <coord1>/'none' [coord2...]' (repeating the input and adding the coords).
      Let me know how it works for you.
    • Oct 25 2017 | 3:19 pm
      Hi Jeremy!
      Sorry I haven't posted in a while. I was involved in another project. I've just tested your object again. It seems that messages are understood by the object, because there's no error in the console. However, there's no output. As you see in the image, I've tried every message box in the image. There's no error, no output either. If I perform any valid movement, there's output in the console. What could it be?
    • Dec 20 2017 | 1:35 am
      hi i wanted to share a little patch here, that can insert pieces into uci via mouse (without editing the fen-code). for example to setup a chess problem etc. also it can show a list of the taken pieces. have fun klaus
    • Dec 20 2017 | 1:03 pm
      @Klaus you are the king. This is great and should be built-in functionality. But not this year. :-)
    • Dec 20 2017 | 6:59 pm
      thanks jeremy, the tricky part is to get the clicked chess-square. an extra report from uci for this would be fantastic of course. anyway, here is a cleaned up version with the additional (crucial;) option to change the active colour (W/B).
    • Dec 20 2017 | 7:02 pm
      btw, the link ( to the most recent version of uci is dead.
    • Dec 21 2017 | 7:29 am
      @klaus, it's working for me... maybe a glitch at the host?
    • Dec 21 2017 | 9:15 pm
      sorry yes, its working..
    • Dec 24 2017 | 2:13 pm
      @Lucas Rei ... there is a fifth outlet of uci, that you did not connect (at least in your screenshot).
    • Apr 05 2018 | 6:04 pm
      Sorry for not having answering all this time. The new additions work really fine. Thanks! @Klaus Filip you were absolutely right, I missed some connections. Thanks!
    • Apr 05 2018 | 6:05 pm
      and thank you very much for the uci-helper! It's great!
    • Nov 24 2021 | 1:59 pm
      Im working on a project making chess to music. I first of all have to thank your for the great work!
      I am having a problem loading stockfish. I get the following when trying to load it:
      uci: load error: could not execute Macintosh HD:/Users/xxxxxxxx/Documents/Max 8/Packages/uci/misc/stockfish-231-64
      Any ideer on how i get it to work?
      kind regards Martin
    • Nov 24 2021 | 2:26 pm
      Assuming that you're running on an Intel 64-bit macOS machine (I haven't ported 'uci' to arm64 yet, but thanks for the reminder), I hope it's just a permissions issue. From the Terminal:
      chmod +x "Macintosh HD:/Users/xxxxxxxx/Documents/Max 8/Packages/uci/misc/stockfish-231-64"
      You probably should get a more recent version of Stockfish, if you want the latest/strongest. Should be free from their website.