Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions games/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,20 @@
},
gui='v3'),

'lunarlockout': Game(
name='LunarLockout',
variants={
'puzzle1': Variant(
name='puzzle1',
data_provider=GamesmanPy,
data_provider_game_id='lunarlockout',
data_provider_variant_id='puzzle1',
gui='v3'),
},
is_two_player_game=False,
gui='v3'
),

'mancala': Game(
name='Mancala',
variants={
Expand Down
25 changes: 24 additions & 1 deletion games/image_autogui_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,29 @@ def get_lite3(variant_id):
}
}
}


def get_lunarlockout(variant_id):
return {
"defaultTheme": "regular",
"themes": {
"regular": {
"space": [5, 5],
"centers": [[col + 0.5, row + 0.5] for row in range(5) for col in range(5)],
"background": "lunarlockout/board.svg",
"charImages": {
"0": {"image": "lunarlockout/robotcat0.svg", "scale": 1},
"1": {"image": "lunarlockout/robotcat1.svg", "scale": 1},
"2": {"image": "lunarlockout/robotcat2.svg", "scale": 1},
"3": {"image": "lunarlockout/robotcat3.svg", "scale": 1},
"4": {"image": "lunarlockout/robotcat4.svg", "scale": 1},
},
"arrowWidth": 0.06,
"entitiesOverArrows": True,
"animationType": "simpleSlides"
}
}
}

def get_mutorere(variant_id):
return {
"defaultTheme": "octagon",
Expand Down Expand Up @@ -2791,6 +2813,7 @@ def get_orbito(variant_id):
"lgame": get_lgame,
"lightsout": get_lightsout,
"lite3": get_lite3,
"lunarlockout": get_lunarlockout,
"mutorere": get_mutorere,
"neutron": get_neutron,
"nim": get_nim,
Expand Down
17 changes: 17 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ def key_move_obj_by_move_value_then_delta_remoteness(move_obj):
return (VALUES.index(move_value), delta_remotenesss)

def wrangle_move_objects_1Player(position_data):
# If this position is losing, ALL moves are losing
if position_data.get('positionValue') == Value.LOSE:
move_objs = position_data.get('moves', [])
for move_obj in move_objs:
move_obj['moveValue'] = Value.LOSE
move_obj['deltaRemoteness'] = 0
move_objs.sort(key=key_move_obj_by_move_value_then_delta_remoteness)
return

if 'remoteness' not in position_data: # Means not possible to solve puzzle from this state
position_data['remoteness'] = Remoteness.INFINITY
current_position_remoteness = position_data['remoteness']
Expand All @@ -43,6 +52,14 @@ def wrangle_move_objects_1Player(position_data):
# Moves that reduce remoteness should be green. Moves that increase remoteness should
# be red. Moves that neither reduce nor increase remoteness should be yellow.
move_obj['moveValue'] = Value.WIN if delta_remoteness > 0 else Value.LOSE if delta_remoteness < 0 else Value.TIE
Comment thread
iopkelvin marked this conversation as resolved.
if move_obj.get('positionValue') == Value.LOSE:
move_obj['moveValue'] = Value.LOSE
else:
move_obj['moveValue'] = (
Value.WIN if delta_remoteness > 0
else Value.LOSE if delta_remoteness < 0
else Value.TIE
)
move_objs.sort(key=key_move_obj_by_move_value_then_delta_remoteness)

def wrangle_move_objects_2Player(position_data):
Expand Down