aboutsummaryrefslogtreecommitdiffstats
path: root/solver.py
diff options
context:
space:
mode:
Diffstat (limited to 'solver.py')
-rwxr-xr-xsolver.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/solver.py b/solver.py
index b21ea88..6c8ee0e 100755
--- a/solver.py
+++ b/solver.py
@@ -20,7 +20,7 @@ import yaml
class Kana:
- types_without_kana = ('void', 'empt')
+ types_without_kana = ('void', 'empt', 'fblk')
types_valid_for_chain = ('norm', 'froz', 'rock', 'ar_u', 'ar_l', 'ar_d', 'ar_r')
types_with_kana = types_valid_for_chain + ('myst', )
types_all = types_with_kana + types_without_kana
@@ -69,13 +69,14 @@ class KanaGrid:
kana1 = self.get_kana(pos1)
kana2 = self.get_kana(pos2)
table_ok = {
- 'norm': ('norm', 'empt', 'froz', 'ar_u', 'ar_r', 'ar_d', 'ar_l'),
- 'empt': ('norm', 'froz', 'ar_u', 'ar_r', 'ar_d', 'ar_l'),
- 'froz': ('norm', 'empt', 'ar_u', 'ar_r', 'ar_d', 'ar_l'),
- 'ar_u': ('norm', 'empt', 'froz', 'ar_d' ),
- 'ar_r': ('norm', 'empt', 'froz', 'ar_l'),
- 'ar_d': ('norm', 'empt', 'froz', 'ar_u' ),
- 'ar_l': ('norm', 'empt', 'froz', 'ar_r' ),
+ 'norm': ('norm', 'empt', 'froz', 'fblk', 'ar_u', 'ar_r', 'ar_d', 'ar_l'),
+ 'empt': ('norm', 'froz', 'fblk', 'ar_u', 'ar_r', 'ar_d', 'ar_l'),
+ 'froz': ('norm', 'empt', 'ar_u', 'ar_r', 'ar_d', 'ar_l'),
+ 'fblk': ('norm', 'empt', 'ar_u', 'ar_r', 'ar_d', 'ar_l'),
+ 'ar_u': ('norm', 'empt', 'froz', 'fblk', 'ar_d' ),
+ 'ar_r': ('norm', 'empt', 'froz', 'fblk', 'ar_l'),
+ 'ar_d': ('norm', 'empt', 'froz', 'fblk', 'ar_u' ),
+ 'ar_l': ('norm', 'empt', 'froz', 'fblk', 'ar_r' ),
}
if kana1.type_name in table_ok:
if kana2.type_name in table_ok[kana1.type_name]:
@@ -189,7 +190,7 @@ class KanaGrid:
def swap_kana(self, pos1, pos2):
kana_dst = self.get_kana(pos2)
- if kana_dst.type_name == 'froz':
+ if kana_dst.type_name in ('froz', 'fblk'):
pos_tmp = pos1
pos1 = pos2
pos2 = pos_tmp
@@ -206,7 +207,7 @@ class KanaGrid:
self.set_kana(pos_src, kana_dst)
self.set_kana(pos_dst, kana_src)
- if kana_src.type_name != 'froz':
+ if kana_src.type_name not in ('froz', 'fblk') :
break
pos_src = pos_dst
@@ -248,6 +249,7 @@ def repr_grid(grid, grid_size):
'ar_d': ('\x1b[30m∨\x1b[0m', '\x1b[30m∨\x1b[0m'),
'ar_l': ('\x1b[30m<\x1b[0m', '\x1b[30m<\x1b[0m'),
'froz': (' \x1b[36m', '\x1b[0m '),
+ 'fblk': (' \x1b[36m[]', '\x1b[0m '),
'rock': (' \x1b[1;40m', '\x1b[0m '),
'myst': ('\x1b[33m?', '?\x1b[0m'),
}
@@ -262,6 +264,11 @@ def repr_grid(grid, grid_size):
line += ' '
elif tname == 'empt':
line += '| |'
+ elif tname == 'fblk':
+ line += '|%s%s|' % (
+ indicator_map[tname][0],
+ indicator_map[tname][1],
+ )
elif tname in indicator_map:
line += '|%s%s%s|' % (
indicator_map[tname][0],