I finished a university project working extensively with matlab, so I decided to create a chess engine on matlab too. Has anyone had any experience creating/using a chess engine on matlab. I understand it is significantly less efficient than a lower level language like c or c++. It is currently working but it is slow/bad (maybe like 900 rating)

Are there any other open source Matlab engines I can learn from?

  • 1
    Please clarify your question. Are you just looking for chess engines written in Matlab, or something further?
    – qwr
    May 18, 2023 at 15:31
  • 2
    Julia may be worth exploring if you're looking for a high-level language that's easy to code with but with superspeed capabilities. May 18, 2023 at 18:06
  • 1
    You can compile your code from Matlab to C using MEX. It’s a lot faster that way.
    – Mattt
    May 21, 2023 at 1:01
  • 1
    @Mattt Isn't Mex the opposite thing, taking C or Fortran code and setting it up so that it is callable from Matlab? Maybe you are thinking about Matlab Coder and Compiler. May 21, 2023 at 9:53

1 Answer 1


DiamondKnife (https://github.com/DiamondJM/DiamondKnife) is claimed to have a 1700 rapid FICS rating, which is of course abysmal by computer chess standards, but might be good enough for your purposes (depends strongly on the quality of the code base, I suppose... which I haven't checked).

If I wanted to create a strong engine in MATLAB, I would (apart from thinking about porting standard algorithms to MATLAB, which will always be slow, but should still be able to play well compared to most humans if it is done well) think about whether it is possible to convert one of the LC0 neural networks to a format that MATLAB understands, like ONNX. If that is successfully done, it would allow implementation of a very good, extremely selective search policy on top of a very good evaluation function and would put GM-level play firmly into reach for a MATLAB based program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.