Answers.Body: <p>The standard way to connect a chess engine to anything is the <a href="http://wbec-ridderkerk.nl/html/UCIProtocol.html" rel="nofollow noreferrer">UCI - the universal chess interface.</a></p>
  
  <p>It specifies how the output (and input) of an engine should be structured to be understood by an UI or any other interface. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-29T07:24:22.320Z
Answers.LastActivityDate: 2019-11-29T07:24:22.320Z
Answers.UserDisplayName: BlindKungFuMaster
Answers.Body: <p><a href="https://lichess.org/team/lichess-bots" rel="nofollow noreferrer">https://lichess.org/team/lichess-bots</a> has the documentation you are looking for. If you just want the gui you can embed it like in the project used by <a href="http://lichess.bitplan.com" rel="nofollow noreferrer">http://lichess.bitplan.com</a>. If you want to do moves it depends on the programming language you are using. For python e.g. there are ready to use libraries:</p>
  
  <ul>
  <li><a href="https://github.com/rhgrant10/berserk" rel="nofollow noreferrer">https://github.com/rhgrant10/berserk</a></li>
  <li><a href="https://github.com/ShailChoksi/lichess-bot" rel="nofollow noreferrer">https://github.com/ShailChoksi/lichess-bot</a></li>
  </ul>
  
  <p>As a committer of <a href="https://github.com/WolfgangFahl/play-chess-with-a-webcam" rel="nofollow noreferrer">Play Chess With a WebCam</a> i'll also point you to the implementation within this project see: <a href="https://github.com/WolfgangFahl/play-chess-with-a-webcam/blob/master/pcwawc/lichess.py" rel="nofollow noreferrer">lichess.py</a> and the tests for it <a href="https://github.com/WolfgangFahl/play-chess-with-a-webcam/blob/master/tests/test_lichess.py" rel="nofollow noreferrer">test_lichess.py</a> </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-26T12:33:45.490Z
Answers.LastActivityDate: 2019-12-26T12:33:45.490Z
Answers.UserDisplayName: Wolfgang Fahl
Answers.Body: <p>There are plenty resources available. First of all, you may be interested in the <a href="https://en.wikipedia.org/wiki/Universal_Chess_Interface" rel="noreferrer">Universal Chess Interface</a> protocol. This is a text protocol that many engines use. A compiled list is available <a href="http://www.sdchess.ru/Engines_UCI_top.htm" rel="noreferrer">here</a>.</p>
  
  <p>The protocol specification is available for download <a href="https://www.shredderchess.com/download.html" rel="noreferrer">here</a> (last link on the page).
  There is also a <a href="https://python-chess.readthedocs.io" rel="noreferrer">python implementation</a> of the protocol.</p>
  
  <p>Last but not least, there exists a <a href="https://python-lichess.readthedocs.io" rel="noreferrer">lichess API implementation in Python</a>, so you could talk to lichess directly.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-29T07:34:48.600Z
Answers.LastActivityDate: 2019-11-29T07:34:48.600Z
Answers.UserDisplayName: Stanley F.
Body: <p>I'm a hobbyist chess programmer. I've built a few engines from scratch, had lots of fun, and am generally pretty proud of what I've made (I estimate ~1400-1500 though it's hard to tell).</p>
  
  <p>I was very excited when I found out you can make a bot account on lichess. After a few hours of messing around, I successfully played a game against Stockfish running on my computer through the lichess interface, so I think I (sort of) know how to connect an engine to my bot account. </p>
  
  <p>However, for all the engines I've made in the past, I have made my own board representation and move in/output. Obviously I'll need to make some modifications to them in order to connect them to lichess. When connecting Stockfish to my account, I used the Stockfish .exe file you can download online. The lichess interface accepted it, so I'm guessing there's some semi-standard way to make interface with engines. I would like to make one of these interfaces. </p>
  
  <p>Questions: am I correct that there is a standard way to interface with an engine? If so, how would you go about making one? Are there any good guides to doing so?  </p>
  
  <p>Or perhaps more generally: how would you adapt a "from scratch" engine to play on lichess?</p>
  
  <hr>
  
  <p>I'm almost entirely self taught programming wise, and am very conscious of the gaping holes in my understanding of computers/programming. Pointing me to any resources would be very helpful. </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-29T07:46:45.363Z
Comments.Text: FICS [Free Internet Chess Server] also allows a declared engine BOT account.
Comments.UserDisplayName: Snack_Food_Termite
Tags: <engines><programming><lichess>
Title: File format/interface for home-brew engines (and implementation in lichess)
ThreadText: # File format/interface for home-brew engines (and implementation in lichess)
  
  (Asked by: username_0 on 2019-11-29)
  
  I'm a hobbyist chess programmer. I've built a few engines from scratch, had lots of fun, and am generally pretty proud of what I've made (I estimate ~1400-1500 though it's hard to tell).
  
  I was very excited when I found out you can make a bot account on lichess. After a few hours of messing around, I successfully played a game against Stockfish running on my computer through the lichess interface, so I think I (sort of) know how to connect an engine to my bot account.
  
  However, for all the engines I've made in the past, I have made my own board representation and move in/output. Obviously I'll need to make some modifications to them in order to connect them to lichess. When connecting Stockfish to my account, I used the Stockfish .exe file you can download online. The lichess interface accepted it, so I'm guessing there's some semi-standard way to make interface with engines. I would like to make one of these interfaces.
  
  Questions: am I correct that there is a standard way to interface with an engine? If so, how would you go about making one? Are there any good guides to doing so?
  
  Or perhaps more generally: how would you adapt a "from scratch" engine to play on lichess?
  
  ---
  
  I'm almost entirely self taught programming wise, and am very conscious of the gaping holes in my understanding of computers/programming. Pointing me to any resources would be very helpful.
  
  **Tags:** engines, programming, lichess
  
  > **Comments:**
  > **username_1**: FICS [Free Internet Chess Server] also allows a declared engine BOT account.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_4 on 2019-11-29. Score: 5 | Accepted answer
  
  There are plenty resources available. First of all, you may be interested in the [Universal Chess Interface](https://en.wikipedia.org/wiki/Universal_Chess_Interface) protocol. This is a text protocol that many engines use. A compiled list is available [here](http://www.sdchess.ru/Engines_UCI_top.htm).
  
  The protocol specification is available for download [here](https://www.shredderchess.com/download.html) (last link on the page).
  There is also a [python implementation](https://python-chess.readthedocs.io) of the protocol.
  
  Last but not least, there exists a [lichess API implementation in Python](https://python-lichess.readthedocs.io), so you could talk to lichess directly.
  
  
  ---
  
  ### Answer by username_2 on 2019-11-29. Score: 4
  
  The standard way to connect a chess engine to anything is the [UCI - the universal chess interface.](http://wbec-ridderkerk.nl/html/UCIProtocol.html)
  
  It specifies how the output (and input) of an engine should be structured to be understood by an UI or any other interface.
  
  
  ---
  
  ### Answer by username_3 on 2019-12-26. Score: 2
  
  <https://lichess.org/team/lichess-bots> has the documentation you are looking for. If you just want the gui you can embed it like in the project used by <http://lichess.bitplan.com>. If you want to do moves it depends on the programming language you are using. For python e.g. there are ready to use libraries:
  
  * <https://github.com/rhgrant10/berserk>
  * <https://github.com/ShailChoksi/lichess-bot>
  
  As a committer of [Play Chess With a WebCam](https://github.com/username_3/play-chess-with-a-webcam) i'll also point you to the implementation within this project see: [lichess.py](https://github.com/username_3/play-chess-with-a-webcam/blob/master/pcwawc/lichess.py) and the tests for it [test\_lichess.py](https://github.com/username_3/play-chess-with-a-webcam/blob/master/tests/test_lichess.py)
  
  
  ---
  
  