@@ -103,6 +103,7 @@ def format_board(cls, board):
103103 def rcc_fill_table (self ):
104104 if table [self .id ] != 255 :
105105 return table [self .id ]
106+ # the amount of reduction
106107 if self .board [0 ] > 10 :
107108 raise Exception ("more than 10 zeros?????? WTF" )
108109 # FIXMEEEEEE
@@ -113,20 +114,27 @@ def rcc_fill_table(self):
113114 if self .board [0 ] == 9 :
114115 for k , v in enumerate (self .board [1 :], 1 ):
115116 if v != 0 :
117+ # v is going to be 1
118+ # return the tile
116119 table [self .id ] = k
117- return table [ self . id ]
120+ return k
118121 # for every other case
122+ # print("*"*100)
119123 nonzero = np .where (self .board != 0 )[0 ]
124+ # print(nonzero)
120125 if nonzero [0 ] == 0 :
121126 nonzero = nonzero [1 :]
122127 if len (nonzero ) == 0 :
123128 print (self .board )
124129 raise Exception (
125130 "WHAT... len was 0 which means zero count should be 0" )
131+ # print(nonzero)
126132 minlost = 254
127133 # print(nonzero)
128134 for key , select in enumerate (nonzero , 1 ):
129135 if self .board [select ] > 1 :
136+ # removing two at once
137+ # no reduction
130138 board = self .board .copy ()
131139 board [select ] -= 2
132140 board [0 ] += 2
@@ -141,56 +149,64 @@ def rcc_fill_table(self):
141149 board [target - select ] += 1
142150 board [0 ] += 1
143151 minlost = min (FeverBoard (board ).rcc_fill_table ()+ select , minlost )
152+ if minlost == 254 :
153+ print ("minlost was 254 what" )
154+ exit ()
144155 table [self .id ] = minlost
145- return table [ self . id ]
156+ return minlost
146157
147158
148- original_board = FeverBoard (FeverBoard .format_board (
149- [0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ]))
150- print (original_board .id )
151- original_board = FeverBoard (FeverBoard .format_board (
152- [13 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 , 15 ]))
153- print (original_board .id )
159+ # original_board = FeverBoard(FeverBoard.format_board(
160+ # [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
161+ # print(original_board.id)
162+ # original_board = FeverBoard(FeverBoard.format_board(
163+ # [13, 15, 15, 15, 15, 15, 15, 15, 15, 15]))
164+ # print(original_board.id)
154165
155166
156167# print(original_board)
157168
158169# testing purpose
159170
160- test_next = nHr_next (16 , 10 )
161- for i in range (1000 ):
162- tbl = test_next ()
163- # print("------")
164- print (tbl , " - " , end = "" )
165- print (FeverBoard (FeverBoard .format_board (tbl )).id )
166- assert (i == FeverBoard (FeverBoard .format_board (tbl )).id )
171+ # test_next = nHr_next(16, 10)
172+ # for i in range(1000):
173+ # tbl = test_next()
174+ # # print("------")
175+ # print(tbl, " - ", end="")
176+ # print(FeverBoard(FeverBoard.format_board(tbl)).id)
177+ # assert(i == FeverBoard(FeverBoard.format_board(tbl)).id)
167178
168179
169180# 255 is the marker for "not calculated yet"
170181
171- # table[0] = 0
172- # next = nHr_next(16, 10)
173- # counter = 0
174- # kcounter=0
175- # for id in range(3268760):
176- # arr = next()
177- # if table[id] != 255:
178- # continue
179- # FeverBoard(FeverBoard.format_board(arr)).rcc_fill_table()
180- # counter+=1
181- # if counter == 1000:
182- # counter = 0
183- # kcounter += 1
184- # if kcounter % 10 == 0:
185- # print(f"{kcounter}k+ values written id {id}")
186- # table.tofile("v10_fevertime_table.bin")
187- # print("done writing on file")
188-
189-
190- # # # add main logic
191-
192-
193- # table.tofile("v10_fevertime_table.bin")
182+
183+ # print(FeverBoard(FeverBoard.format_board([11, 5, 5, 4, 14, 15, 3, 0, 1, 13])).rcc_fill_table())
184+
185+ # exit()
186+
187+ table [0 ] = 0
188+ next = nHr_next (16 , 10 )
189+ counter = 0
190+ kcounter = 0
191+ for id in range (3268760 ):
192+ arr = next ()
193+ if table [id ] != 255 :
194+ continue
195+ FeverBoard (FeverBoard .format_board (arr )).rcc_fill_table ()
196+ counter += 1
197+ if counter == 1000 :
198+ counter = 0
199+ kcounter += 1
200+ if kcounter % 10 == 0 :
201+ print (f"{ kcounter } k+ values written id { id } " )
202+ table .tofile ("v10_fevertime_table.bin" )
203+ print ("done writing on file" )
204+
205+
206+ # # add main logic
207+
208+
209+ table .tofile ("v10_fevertime_table.bin" )
194210
195211
196212
0 commit comments