mirror of
https://github.com/a2-4am/4cade.git
synced 2025-02-21 03:29:24 +00:00
tweak search cache algorithm
This commit is contained in:
parent
5ea25ade72
commit
db777bb5cd
@ -35,6 +35,8 @@ def best(keys, games):
|
|||||||
bestindex = -1
|
bestindex = -1
|
||||||
bestlikely = False
|
bestlikely = False
|
||||||
for game in games:
|
for game in games:
|
||||||
|
if game.startswith(keys):
|
||||||
|
return gameindex
|
||||||
gamescore, likely = score(keys, game)
|
gamescore, likely = score(keys, game)
|
||||||
if (gamescore > bestscore):
|
if (gamescore > bestscore):
|
||||||
bestscore = gamescore
|
bestscore = gamescore
|
||||||
@ -42,7 +44,7 @@ def best(keys, games):
|
|||||||
bestlikely = likely
|
bestlikely = likely
|
||||||
gameindex += 1
|
gameindex += 1
|
||||||
if not bestlikely:
|
if not bestlikely:
|
||||||
return 0
|
return -1
|
||||||
return bestindex
|
return bestindex
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -50,24 +52,24 @@ def main():
|
|||||||
cache = OrderedDict()
|
cache = OrderedDict()
|
||||||
for a in ascii_lowercase:
|
for a in ascii_lowercase:
|
||||||
index1 = best(a, games)
|
index1 = best(a, games)
|
||||||
if not index1: continue
|
if index1 < 0: continue
|
||||||
cache[a] = OrderedDict()
|
cache[a] = OrderedDict()
|
||||||
cache[a][" "] = index1
|
cache[a][" "] = index1
|
||||||
for b in ascii_lowercase:
|
for b in ascii_lowercase:
|
||||||
index2 = best(a+b, games)
|
index2 = best(a+b, games)
|
||||||
if not index2: continue
|
if index2 < 0: continue
|
||||||
cache[a][b] = OrderedDict()
|
cache[a][b] = OrderedDict()
|
||||||
if index2 != index1:
|
if index2 != index1:
|
||||||
cache[a][b][" "] = index2
|
cache[a][b][" "] = index2
|
||||||
for c in ascii_lowercase:
|
for c in ascii_lowercase:
|
||||||
index3 = best(a+b+c, games)
|
index3 = best(a+b+c, games)
|
||||||
if not index3: continue
|
if index3 < 0: continue
|
||||||
cache[a][b][c] = OrderedDict()
|
cache[a][b][c] = OrderedDict()
|
||||||
if index3 != index2:
|
if index3 != index2:
|
||||||
cache[a][b][c][" "] = index3
|
cache[a][b][c][" "] = index3
|
||||||
for d in ascii_lowercase:
|
for d in ascii_lowercase:
|
||||||
index4 = best(a+b+c+d, games)
|
index4 = best(a+b+c+d, games)
|
||||||
if not index4: continue
|
if index4 < 0: continue
|
||||||
if index4 != index3:
|
if index4 != index3:
|
||||||
cache[a][b][c][d] = index4
|
cache[a][b][c][d] = index4
|
||||||
if not cache[a][b][c]:
|
if not cache[a][b][c]:
|
||||||
|
BIN
res/CACHE00.IDX
BIN
res/CACHE00.IDX
Binary file not shown.
BIN
res/CACHE01.IDX
BIN
res/CACHE01.IDX
Binary file not shown.
BIN
res/CACHE10.IDX
BIN
res/CACHE10.IDX
Binary file not shown.
BIN
res/CACHE11.IDX
BIN
res/CACHE11.IDX
Binary file not shown.
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16124086
|
!be24 16124404
|
||||||
!le16 5266
|
!le16 5266
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16061620
|
!be24 16061938
|
||||||
!le16 5807
|
!le16 5807
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 15992385
|
!be24 15992385
|
||||||
!le16 4264
|
!le16 4148
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16007248
|
!be24 16007132
|
||||||
!le16 4728
|
!le16 4618
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16026261
|
!be24 16026035
|
||||||
!le16 5705
|
!le16 5951
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16047640
|
!be24 16047660
|
||||||
!le16 6286
|
!le16 6584
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16129352
|
!be24 16129670
|
||||||
!le16 410
|
!le16 410
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16130106
|
!be24 16130424
|
||||||
!le16 449
|
!le16 449
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16067427
|
!be24 16067745
|
||||||
!le16 1757
|
!le16 1757
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16076257
|
!be24 16076575
|
||||||
!le16 1640
|
!le16 1640
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16129838
|
!be24 16130156
|
||||||
!le16 67
|
!le16 67
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16124043
|
!be24 16124361
|
||||||
!le16 43
|
!le16 43
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16122379
|
!be24 16122697
|
||||||
!le16 1510
|
!le16 1510
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16107022
|
!be24 16107340
|
||||||
!le16 590
|
!le16 590
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16073617
|
!be24 16073935
|
||||||
!le16 2640
|
!le16 2640
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16078255
|
!be24 16078573
|
||||||
!le16 246
|
!le16 246
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16078501
|
!be24 16078819
|
||||||
!le16 538
|
!le16 538
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16079039
|
!be24 16079357
|
||||||
!le16 7694
|
!le16 7694
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16129762
|
!be24 16130080
|
||||||
!le16 76
|
!le16 76
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16123889
|
!be24 16124207
|
||||||
!le16 154
|
!le16 154
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16129905
|
!be24 16130223
|
||||||
!le16 201
|
!le16 201
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16107612
|
!be24 16107930
|
||||||
!le16 4352
|
!le16 4352
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16111964
|
!be24 16112282
|
||||||
!le16 1752
|
!le16 1752
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16113716
|
!be24 16114034
|
||||||
!le16 1194
|
!le16 1194
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16114910
|
!be24 16115228
|
||||||
!le16 3454
|
!le16 3454
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16118364
|
!be24 16118682
|
||||||
!le16 3484
|
!le16 3484
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16121848
|
!be24 16122166
|
||||||
!le16 404
|
!le16 404
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16122252
|
!be24 16122570
|
||||||
!le16 127
|
!le16 127
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16130555
|
!be24 16130873
|
||||||
!le16 2370
|
!le16 2370
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16092138
|
!be24 16092456
|
||||||
!le16 5196
|
!le16 5196
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16097334
|
!be24 16097652
|
||||||
!le16 2502
|
!le16 2502
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16053926
|
!be24 16054244
|
||||||
!le16 7694
|
!le16 7694
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 15996649
|
!be24 15996533
|
||||||
!le16 10599
|
!le16 10599
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16011976
|
!be24 16011750
|
||||||
!le16 14285
|
!le16 14285
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16031966
|
!be24 16031986
|
||||||
!le16 15674
|
!le16 15674
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16077897
|
!be24 16078215
|
||||||
!le16 358
|
!le16 358
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16086733
|
!be24 16087051
|
||||||
!le16 5405
|
!le16 5405
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16099836
|
!be24 16100154
|
||||||
!le16 7186
|
!le16 7186
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
; This file is automatically generated
|
; This file is automatically generated
|
||||||
;
|
;
|
||||||
!byte 0
|
!byte 0
|
||||||
!be24 16069184
|
!be24 16069502
|
||||||
!le16 4433
|
!le16 4433
|
||||||
|
Loading…
x
Reference in New Issue
Block a user