cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A157851 Number of possible Fischer Random Chess games at the end of the n-th ply.

This page as a plain text file.
%I A157851 #31 May 19 2023 08:01:53
%S A157851 960,18882,371766,8224968,181106056,4433048830,107637760217,
%T A157851 2854198413886,75006431287937
%N A157851 Number of possible Fischer Random Chess games at the end of the n-th ply.
%C A157851 Fischer Random Chess is also called Chess960 because the number of different initial positions is 960.
%C A157851 The number of possible games at the end of the n-th ply is the sum of all possible games on all 960 boards with a different initial position.
%C A157851 The number of possible first moves for white depends on the following three factors:
%C A157851 a) The eight pawns.
%C A157851 b) The positions of the two knights. If they are on a1 and/or h1 the number of possible moves reduces from 20 to 18 or 19. On the 960 boards there are 240 boards with a knight on a1. Looking more closely at the positions of the second knight on these 240 boards reveals that 36 knights can be found on b1, d1, f1 and h1 and 32 knights can be found on c1, e1 and g1, something that can be proved with some simple combinatorics.
%C A157851 c) The possibility of castling. On the 960 boards there are 72 boards with a king on d1 and a rook on c1 and there are 90 boards with a king on f1 and a rook on g1. Both positions allow castling under the Fischer Random Chess rules.
%C A157851 These three factors lead to the following partition of the 960 boards (K = King; R = Rook; N = Knight; NoN = No Knight; NoC = No castling allowed): 454 (NoNa1+NoNh1+NoC), 162 (Na1+NoNh1+NoC), 160 (Nh1+NoNa1+NoC), 34 (NoNa1+NoNh1+Kf1+Rg1), 28 (NoNa1+NoNh1+Kd1+Rc1), 28 (Nh1+NoNa1+Kf1+Rg1), 22 (Na1+Nh1+NoC), 22 (Na1+NoNh1+Kd1+Rc1), 20 (Na1+NoNh1+Kf1+Rg1), 16 (Nh1+NoNa1+Kd1+Rc1), 8 (Na1+Nh1+Kf1+Rg1), 6 (Na1+Nh1+Kd1+Rc1).
%C A157851 The first three terms of the sequence can be calculated in a straightforward way, see the examples. The values of a(1) and a(2) were confirmed by Richard Pijl with his Fischer Random Chess playing chess engine The Baron, see the links. He also determined the values of a(3), a(4) and a(5).
%C A157851 The Baron 3.41 now gives different values for a(3)-a(6), confirmed by my own chess engine. - _François Labelle_, Dec 05 2017
%H A157851 Chessgames.com, <a href="http://www.chessgames.com/perl/fischerandom">Fischerandom Chess Generator</a>
%H A157851 Chessvariants.com, <a href="http://www.chessvariants.com/diffsetup.dir/fischer.html">Fischer Random Chess</a>
%H A157851 Richard Pijl, <a href="http://www.chessprogramming.net/the-baron/">The Baron</a>
%H A157851 Wikipedia, <a href="http://en.wikipedia.org/wiki/Chess960">Chess960</a>
%e A157851 a(0) = 4 (Bishop) * 4 (Bishop) * 6 (Queen) * 10 (Knights) * 1 (King and Rooks) = 960.
%e A157851 a(1) = 36*18 + 204*19 + 204*19 + 516*20 + 90 + 72 = 18882.
%e A157851 a(2) = 22*18^2 + (162+160+8+6)*19^2 + (454+28+22+20+16)*20^2 + (34+28)*21^2 = 371766.
%o A157851 (Python)
%o A157851 import chess
%o A157851 def A157851(n, b = None): return (b.legal_moves.count() if b else 960) if not n else sum(b.push(m) or A157851(n-1, b)+(not b.pop()) for m in b.legal_moves) if b else sum(A157851(n-1, chess.Board.from_chess960_pos(s)) for s in range(960)) # (For illustration, slow for n > 3.) - _M. F. Hasler_, Apr 25 2023
%Y A157851 Cf. Chess: A006494, A048987, A079485.
%Y A157851 Cf. Go: A007565, A048289.
%Y A157851 Cf. Checkers: A133046, A133047.
%K A157851 hard,nonn,more,fini
%O A157851 0,1
%A A157851 _Johannes W. Meijer_ & Richard Pijl (richard.pijl(AT)telenet.be), Mar 07 2009, Feb 25 2010
%E A157851 Corrected and edited by _Johannes W. Meijer_, Feb 25 2010, Mar 03 2010
%E A157851 a(6) added by Richard Pijl (richard.pijl(AT)telenet.be). - _Johannes W. Meijer_, May 29 2010
%E A157851 a(3)-a(6) corrected by _François Labelle_, Dec 05 2017
%E A157851 a(7)-a(8) from _François Labelle_, Jan 18 2018