MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / check_win

Function check_win

examples/space_invaders/space_invaders.py:474–482  ·  view source on GitHub ↗

Return the number of army glyphs remaining - the player wins if this is zero.

(session, state)

Source from the content-addressed store, hash-verified

472
473
474def check_win(session, state):
475 """Return the number of army glyphs remaining -
476 the player wins if this is zero."""
477
478 return (
479 session.query(func.count(GlyphCoordinate.id))
480 .join(GlyphCoordinate.glyph.of_type(ArmyGlyph))
481 .scalar()
482 )
483
484
485def check_lose(session, state):

Callers 1

update_stateFunction · 0.85

Calls 5

scalarMethod · 0.45
joinMethod · 0.45
queryMethod · 0.45
countMethod · 0.45
of_typeMethod · 0.45

Tested by

no test coverage detected