Skip to main content

Decides when to start a game, based on who's holding a button.

Project description

Build Status Coverage Status

To see a demo of the game start, clone, then run python3 -m GameStarter.gamestart

There are also some test cases that test that the class handles some simple invalid configurations correctly and that it can handle the various imperfections of the humans that want to start a game. Run the tests with python -m GameStarter.gamestart_test

To use this code:

  • import it
	from GameStarter import GameStarter
  • instantiate the GameStarter class
	gs = GameStarter(total start delay, delay to join game, delay to leave game)
	#eg...
	gs = GameStarter(5.0, 2.0, 0.5)
  • then report whenever a player pushes or releases a button:
	gs.player(0).push()	#report button push for first player
	gs.player(1).release()	#report button release for second player
  • regularly update the internal timer at the desired resolution:
	gs.step_time(0.05) #Step 0.05 seconds, call this every 0.05 seconds (for example)
  • then you can see if you have enough players ready like so:
	if gs.should_start : #we have enough players to start
  • you can determine which players have joined using:
	gs.joined_players

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

game-starter-2.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

game_starter-2.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file game-starter-2.0.0.tar.gz.

File metadata

  • Download URL: game-starter-2.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for game-starter-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1db195004fb36a96ca223fe74635b28104122ccd831156e3ec266d0db0df09a2
MD5 4eb5071a6cf2c0ac444b1e3973cabc76
BLAKE2b-256 3fa54598068a86635d854ee1c82ef81ad2a39d3dd037b7de09e3fb76e0be54ca

See more details on using hashes here.

File details

Details for the file game_starter-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: game_starter-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for game_starter-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2680d4bf93bef984c35e8be1b185f6fee435149700677b3622a5e83e8a5f179e
MD5 566a82855f48a0b83ff0084a019763c1
BLAKE2b-256 c08c28e47a9879432caaa85952915dc652af05d1a7dfec536a2da913ff4b9b7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page