Progress on Rustic

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Progress on Rustic

Post by mvanthoor »

Almost done with implementing and testing XBoard protocol / CECP. The only commands to go are "time", "otim", and "level". Tomorrow I should be able to try and play a game using "st" and/or "sd", as a Winboard engine.

PS: Rustic is not "really" a UCI or Winboard engine. Internally, it uses collections of structs.

uci's "position fen <string>" is basically the same as "setboard <fen>"
uci's "info" output is the same as xboard's "thinking output"
same for the "." command: it requests information that uci already sends by default (time, nodes, currmove, etc....)

So, internally the engine uses its own struct stuff, and the uci/xboard communication modules transform incoming commands to something the engine understands, and outgoing data into either uci or xboard. Both protocols are built on top of the same infrastructure. Nothing within the engine except the main engine thread itself is aware if it is running the UCI or XBoard modules; and the main engine thread only uses this information to buffer the incoming search stats until the GUI asks for it with the Dot-command. (Maybe I'll even take that out of the engine thread an move the buffering to the XBoard module: so the engine does send the incoming stats to be printed, but the comm module can catch those and buffer/update them until the Dot comes in.)

Actually, if I would take the time to implement disconnecting and reconnecting the comm threads, and have a GUI that supports it, I could have the engine switch from UCI to XBoard in the middle of a search if I'd want to... but fortunately no GUI supports insane stuff like that, so I don't get tempted to try it :shock:
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
Pi4Chess
Posts: 253
Joined: Mon Nov 16, 2020 12:13 pm
Full name: Manuel Rivera

Re: Progress on Rustic

Post by Pi4Chess »

tried to compile Rustic installing Cargo on my Rpi4 and did not managed to because i am getting the following errors :

Rustic : error E06658 related to "while is not allowed in a 'const_fn'" lines 122 to 125 lines 135 to 138 and lines 147 to 150 in file src/board/defs.rs
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Progress on Rustic

Post by Guenther »

Pi4Chess wrote: Sun Dec 06, 2020 12:38 pm tried to compile Rustic installing Cargo on my Rpi4 and did not managed to because i am getting the following errors :

Rustic : error E06658 related to "while is not allowed in a 'const_fn'" lines 122 to 125 lines 135 to 138 and lines 147 to 150 in file src/board/defs.rs
This was already discussed here in this thread ;-)

see this and Marcels answer - too make it short your rust installation is too old, you must have at least 1.47
http://talkchess.com/forum3/viewtopic.p ... 00#p873388
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
Pi4Chess
Posts: 253
Joined: Mon Nov 16, 2020 12:13 pm
Full name: Manuel Rivera

Re: Progress on Rustic

Post by Pi4Chess »

Guenther wrote: Sun Dec 06, 2020 12:49 pm
Pi4Chess wrote: Sun Dec 06, 2020 12:38 pm tried to compile Rustic installing Cargo on my Rpi4 and did not managed to because i am getting the following errors :

Rustic : error E06658 related to "while is not allowed in a 'const_fn'" lines 122 to 125 lines 135 to 138 and lines 147 to 150 in file src/board/defs.rs
This was already discussed here in this thread ;-)

see this and Marcels answer - too make it short your rust installation is too old, you must have at least 1.47
http://talkchess.com/forum3/viewtopic.p ... 00#p873388
Oh Sorry 🙃 Thanks for the info. I will try to see if another version of rust is available for my platform this evening . I installed cargo and the synaptic package manager took all he needed included rustc.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Progress on Rustic

Post by Ras »

Pi4Chess wrote: Sun Dec 06, 2020 1:59 pmI will try to see if another version of rust is available for my platform this evening . I installed cargo and the synaptic package manager took all he needed included rustc.
Here's the problem: you are using an LTS (long term support) distro. This means that it will keep whatever version of programs it had and only release bugfixes and security updates, but not new feature versions. The idea is to keep things from breaking because new features often can introduce new bugs or break existing workflows.

Rust on the other hand has not stabilised. They release a new Rust compiler every six weeks, and if you want to compile a Rust program that uses new Rust features, you need a new compiler - which you won't get through the package manager of an LTS distro.

Two solutions are possible:

1) You don't install the Rust compiler through the distro's package manager, but use the tool "rustup" which is provided by the Rust team exactly to address this situation: https://www.rust-lang.org/tools/install. This seems to be the easiest way because it allows you to keep the stability of an LTS distro.

2) You switch to a rolling release distro, such as Manjaro, which does update program versions all the time. The risk for something breaking can be higher with such a distro.
Rasmus Althoff
https://www.ct800.net
Pi4Chess
Posts: 253
Joined: Mon Nov 16, 2020 12:13 pm
Full name: Manuel Rivera

Re: Progress on Rustic

Post by Pi4Chess »

Thx Rasmus i will try rustup and see if it works ☺️
Pi4Chess
Posts: 253
Joined: Mon Nov 16, 2020 12:13 pm
Full name: Manuel Rivera

Re: Progress on Rustic

Post by Pi4Chess »

Pi4Chess wrote: Sun Dec 06, 2020 5:33 pm Thx Rasmus i will try rustup and see if it works ☺️
Rust 1.48 installed with rustup and managed to compile Rustic 0.1 and 2 other rust engines (cicada 0.1 claims about 1600 elo and chareth 0.1).

Keep up the good work :-)
User avatar
Guenther
Posts: 4605
Joined: Wed Oct 01, 2008 6:33 am
Location: Regensburg, Germany
Full name: Guenther Simon

Re: Progress on Rustic

Post by Guenther »

mvanthoor wrote: Mon Nov 16, 2020 4:36 pm
Guenther wrote: Mon Nov 16, 2020 2:35 pm Thanks Marcel. I see, I have just rust version 1.43 installed, which is still the latest available one at msys2, but it is on the 'outdated' list for msys2-packages too ;-)
This package was made available 2020-04, so I guess they will provide a newer one this year anyway.
If I get imaptient I will use one of the choices you mentioned.

I am already using Msys2 for around 2 years and have it working smoothly for C/C++ compiling with gcc/clang.
(Except when my previous virus scanner suddenly ran amok and killed it irreversibly while compiling! due to false positives - very annoying)
I've been using MSYS2 almost as long as it exists. (I like it much better than the mess that the different MinGW distributions have created.) Before MSYS2, I used Cygwin for most of my terminal work and compiling C/C++ programs. I like MSYS2 better because it doesn't require cygwin1.dll.

As there isn't a "real" Windows version of either GCC or Clang (as far as I'm aware of), I use the MSYS2 versions to compile C/C++ engines and that has been working great. As opposed to GCC and Clang however, Rust does have a real (official) Windows-version, and so I have this installed. I only use MSYS2 to issue the build command ("cargo build --release"), and because it provides strip ("strip -s ./target/release/rustic.exe") to strip unused debug-symbols from the release version. The build command itself also runs fine from the Windows command line.

The only roadblock for some people compiling on Linux could be that the distribution-provided version of Rust is too old. (And "too old" could even mean "not the very latest stable.") I always install the latest stable version, and if it provides a new feature that makes my code better/shorter/cleaner, I'll immediately use it. ("while in const fn" allowed me to strip some large tables from the code and have them initialized as constants through a function.)
Just a little feedback. Yesterday I noticed that a new rust package for msys2 was released on 11-29 (based on 1.48.01)
https://packages.msys2.org/package/ming ... 86_64-rust

Now I finally could compile current Rustic :)
https://rwbc-chess.de

trollwatch:
Chessqueen + chessica + AlexChess + Eduard + Sylwy
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Progress on Rustic

Post by mvanthoor »

Guenther wrote: Mon Dec 07, 2020 11:56 am Just a little feedback. Yesterday I noticed that a new rust package for msys2 was released on 11-29 (based on 1.48.01)
https://packages.msys2.org/package/ming ... 86_64-rust

Now I finally could compile current Rustic :)
Nice; but why don't you just install the normal Windows-version? The one advantage of installing the MSYS2 version is that you can then update all your compilers using Pacman; the disadvantage is that you'll always be trailing one/two versions, or sometimes skip a version.

If you decide to compile Rustic, then please use the Master branch. The XBoard branch should work (and compile), but it contains XBoard code that isn't finished yet. I haven't had a lot of time to work with the engine the last two weeks.

In UCI-mode (which is the default if you just start the program) it should be able to play in all normal modes:

- Depth per move
- Time per move
- Nodes per move
- GameTime (time for the rest of the game with or without "movestogo").

If you should test it, I'd expect a strength of somewhere around 1600 ELO for now.

I hope to be able to finish the XBoard implementation this month so it is on par with UCI with regard to playing modes, and release the engine as Rustic Alpha 1. Then in the next year, I'll be working on the search, evaluation, tranposition table.... etc, to see how far I can take it.

PS: I wouldn't advice to install both the Windows and MSYS2 versions of Rust. They'll possibly get tangled with non-working binaries as a result, if a binary can even be produced. I assume that the MSYS2 version of Rust creates the same binaries as the windows-gnu version.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL
User avatar
mvanthoor
Posts: 1784
Joined: Wed Jul 03, 2019 4:42 pm
Location: Netherlands
Full name: Marcel Vanthoor

Re: Progress on Rustic

Post by mvanthoor »

Hi :) A short progress report on Rustic.

Because work has been very busy due to a massive system migration, I'm already at the computer for 10+ hours a day.

I haven't made a lot of progress on finishing the implementation of the XBoard protocol; I've implemented a few commands since the last update, but I still have some to go before I can start testing the engine in XBoard mode.

Therefore I have decided to just go ahead with creating a release for Rustic Alpha 1, so it can at least be tested by the CCRL and/or CEGT folks if they want to. Today I've installed a Linux virtual machine, and Rustic compiled without problems. Because I use MSYS2 on Windows, the build process is actually exactly the same. Actually, in the virtual machine, Rustic runs at the same speed as on Windows. I'm going to see how old a Debian version I can install and still have Rust 1.49 running, so the Linux executable will be able to run on as many systems as possible. These will be the releases:

Windows:
- 64-bit BMI2 (Haswell and up; IIRC)
- 64-bit POPCNT (Intel Nehalem)
- 64-bit Ancient (Intel Core2)
- 32-bit i586 (should basically run on any CPU created since 1995)

Linux:
- 64-bit BMI2
- 64-bit POPCNT
- 64-bit Ancient
- 32-bit: None. You'll have to compile it yourself. Most distributions are dropping 32-bit, and/or require workarounds.

Raspberry Pi (for picochess):
- Should run on any Raspberry Pi that runs the current official 32-bit Buster installation. (If the 64-bit installation becomes available, I'll also provide a 64-bit version.) I also have my own Picochess Buster image online that is smaller than the last official one, has many extra possibilities such as VNC and SSH access. It runs a bugfixed version of the last official Picochess 0.9n. (I use this myself, with my DGT Board.)

The link to the image (on Google Drive) is in the first post of this Google Group thread:
https://groups.google.com/g/picochess/c ... obYjmHBAAJ

Apple OSX:
- I would need help with this. I have no Mac (and will never have one), and I refuse to start hacking around with illegal OSX VM's. It should be possible to cross-compile from either Windows or Linux, but if I do, I can't test it. Then there's the Apple Silicon M1.

PS: I'm not abandoning XBoard. I just want to (finally) release the first version of this engine, and make a first start on the book/tutorial. After XBoard is finished and tested, I'll merge it into master.
Author of Rustic, an engine written in Rust.
Releases | Code | Docs | Progress | CCRL