Implementing FRC?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
MartinBryant
Posts: 69
Joined: Thu Nov 21, 2013 12:37 am
Location: Manchester, UK
Full name: Martin Bryant

Implementing FRC?

Post by MartinBryant »

I've never played Chess960/FRC ("free range chickens" as I like to think of it :D ) but was wondering how hard it is to add to an engine?
I just did some reading and it seems that the only real difference is castling, so I guess the code changes would just be in the routine to generate castling moves and the Make/Unmake routines to execute them.

Is that it? Is it really that simple?
Or am I missing something? :shock:
PK
Posts: 895
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Implementing FRC?

Post by PK »

Royal mess with GUI compatibility. When bcm314 kindly added FRC to Rodent, he ended up writing some code to detect Arena GUI.
Mergi
Posts: 127
Joined: Sat Aug 21, 2021 9:55 pm
Full name: Jen

Re: Implementing FRC?

Post by Mergi »

Yes that's it. Though there's a few tricky things to be mindful of when implementing castling - king not moving, king moving to a square that is occupied by the castling rook, or stepping into a discovery attack, that would otherwise be blocked by the rook ... I found it easiest to just remove the rook -> check all squares are safe -> move the king -> place a new rook at the destination square. Maybe this will help you avoid some bugs i found in my code when implemeting FRC :) Also, Ethereal's FRC Perft test suite was very helpful for making sure everything works properly.

Since there is no official UCI command for FRC (as far as i know), the biggest problem i found was trying to figure out how to encode the castling move when sending it to the GUI (and decoding the move sent from GUI). I believe most GUIs and engines just encode the castling move as king capturing the rook on the side you are trying to castle towards. But as PK said, Arena seems to be broken when playing FRC matches, i never got that one working properly.
Ras
Posts: 2488
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Implementing FRC?

Post by Ras »

Mergi wrote: Tue Sep 28, 2021 11:28 amSince there is no official UCI command for FRC
There is, in the last section of the spec (version: April 2006). It also includes how to encode the castling move to the GUI: "castling moves are sent in the form king "takes" his own rook."
Rasmus Althoff
https://www.ct800.net
User avatar
phhnguyen
Posts: 1442
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: Implementing FRC?

Post by phhnguyen »

An old post but may still be useful:

http://www.open-aurec.com/wbforum/viewt ... f=4&t=5579
https://banksiagui.com
The most features chess GUI, based on opensource Banksia - the chess tournament manager
User avatar
MartinBryant
Posts: 69
Joined: Thu Nov 21, 2013 12:37 am
Location: Manchester, UK
Full name: Martin Bryant

Re: Implementing FRC?

Post by MartinBryant »

Thanks for all the excellent replies. I'll look into them.
Modern Times
Posts: 3554
Joined: Thu Jun 07, 2012 11:02 pm

Re: Implementing FRC?

Post by Modern Times »

Plenty of open source engines that support FRC that you could look at to get an idea how to handle it