MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / update_state

Function update_state

examples/space_invaders/space_invaders.py:718–733  ·  view source on GitHub ↗

Update all state for each game tick.

(session, window, state)

Source from the content-addressed store, hash-verified

716
717
718def update_state(session, window, state):
719 """Update all state for each game tick."""
720
721 num_enemies = state["num_enemies"] = check_win(session, state)
722 if num_enemies == 0:
723 win(session, window, state)
724 elif check_lose(session, state):
725 lose(session, window, state)
726 else:
727 # update the tick counter.
728 state["tick"] += 1
729 move_player(session, window, state)
730 move_missile(session, window, state)
731 move_army(session, window, state)
732 move_saucer(session, window, state)
733 update_splat(session, window, state)
734
735
736def start(session, window, state, continue_=False):

Callers 1

mainFunction · 0.85

Calls 9

check_winFunction · 0.85
winFunction · 0.85
check_loseFunction · 0.85
loseFunction · 0.85
move_playerFunction · 0.85
move_missileFunction · 0.85
move_armyFunction · 0.85
move_saucerFunction · 0.85
update_splatFunction · 0.85

Tested by

no test coverage detected