Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

game-starter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

game-starter

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

  • 2.0.0
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc