[go: up one dir, main page]

login
Revision History for A342329 (Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
Number of different games of Connect Four on an (n+1) X n board.
(history; published version)
#20 by N. J. A. Sloane at Sun Mar 28 18:54:17 EDT 2021
STATUS

editing

approved

#19 by N. J. A. Sloane at Sun Mar 28 18:54:08 EDT 2021
COMMENTS

There are many more game variations than positions in the game Connect Four since almost all positions can be reached in many different ways. For the regular 7 X 6 board there are 4531985219092 (4.5 trillion) legal positions (see A212693). If we estimate the number of possible games with the formula (0.75*(n+1))^(n*(n+1)-1), i.e., on average the players have 75% free columns to choose from, there are about 3.0*10^29 (300 octillion) possible games. Unless a very clever algorithm is found, some 100 terabytes of computer memory will be required to count the games for the 7 X 6 board.

STATUS

proposed

editing

Discussion
Sun Mar 28
18:54
N. J. A. Sloane: Edited
#18 by Robin Jehn at Tue Mar 09 06:45:14 EST 2021
STATUS

editing

proposed

Discussion
Tue Mar 09
07:16
Joerg Arndt: Ah, thanks.  I keep forgetting that about games (I come from combinatorial generation).  Last time I did was less than four weeks ago...
Sat Mar 27
22:58
Sean A. Irvine: I don't believe the statement about memory required.  You can always exchange it for time.  For example, you could simply play out all possible with games with simple backtracking and use essentially no memory.  In practice I would imagine doing a time-memory tradeoff, by playing out some number of steps.  Alternatively define some "modulo" (based on a single large integer representation of the position), and only compute the extensions for a particular residue class at a time.
#17 by Robin Jehn at Tue Mar 09 06:44:05 EST 2021
PROG

(Python)

def next_turn(player): # there are players 0 and 1

global total, position

ngames = 0

for i in range(n+1):

fill = int(column[i]) # height of column i

if fill < n: # throw a disc into column i

position = position + 2 ** (i + (n + 1) * fill + ntimesnplus1 * player) # unique identifier for this position

if position in games: # half of memory and cpu-time can be saved if you exploit symmetry of positions here

ngames = ngames + games[position]

else:

column[i] = column[i] + 1

total = total + 1

if position in setfinalpos: # we have reached a known final position

ngames = ngames + 1

else: # check if the new position is a win or if the board is full

if check4win(position, player, fill, i) or total == ntimesnplus1:

setfinalpos.add(position)

ngames = ngames + 1

else:

numbergames = next_turn(1 - player)

ngames = ngames + numbergames

column[i] = column[i] - 1

total = total - 1

position = position - 2 ** (i + (n + 1) * fill + ntimesnplus1 * player)

games[position] = ngames

return ngames

STATUS

proposed

editing

#16 by Michel Marcus at Tue Mar 09 04:23:08 EST 2021
STATUS

editing

proposed

#15 by Michel Marcus at Tue Mar 09 04:22:43 EST 2021
EXTENSIONS

a(5) = 6961765466482521226 from Kester Habermann, Mar 09 2021

Discussion
Tue Mar 09
04:23
Michel Marcus: as explained in the edit screen you just needed to enter: a(5) from
#14 by Michel Marcus at Tue Mar 09 04:21:32 EST 2021
EXTENSIONS

a(5) = 6961765466482521226 from Kester Habermann, Mar 9 09 2021.

STATUS

proposed

editing

#13 by Kester Habermann at Tue Mar 09 03:29:33 EST 2021
STATUS

editing

proposed

Discussion
Tue Mar 09
04:19
Robin Jehn: Jörg: We have programmed this recursively. The problem is, you have to store for every possible position the number of subsequent games to avoid that you have to count the games again when you will reach a position that you have seen before. And since there are 4 trillion positions you need to store for each of them a 64-bit integer. So with "clever algorithm", more than a recursive algorithm is meant. What could be done of course is not to store anything and just keep counting. With octillions of games this will never terminate.
#12 by Kester Habermann at Tue Mar 09 03:28:28 EST 2021
EXTENSIONS

a(5) = 6961765466482521226 from _Kester Haberman_, Habermann_, Mar 9 2021.

#11 by Kester Habermann at Tue Mar 09 03:25:34 EST 2021
DATA

2, 90, 356232, 152505051772, 6961765466482521226