Skip to main content

Dino Game

GitHub PyPI PyPI - Status GitHub last commit gluten free

A Python reimplementation of the famous dino game, thought for autonomous control

Installation

You can install it from pypi.

pip install dino-game

Usage

Try the game

To try the game without any automation

python -m dinogame

You can use spacebar to start running, jump, reset when dino dies, and key_down to crouch.

Library usage

This initializes the game

from dinogame import DinoGame

game = DinoGame()

To start the game's loop you can use play method

game.play()

Callbacks

The library provides some callbacks to feed back the game

  • loop_callback is called at each new frame
  • gameover_callback is called when a gameover occurs

To subscribe to callback you can use callback's set method.

The current instance of DinoGame is given to the callback as argument.

def lp_cb(game: GameDino):
    # do something

game.loop_callback.set(lp_cb)

Actions

The following actions are provided as methods:

  • jump to jump
  • crouch to crouch
  • stand_up to stand up
  • start_running to start to run
  • reset to reset the game
if the_cake_is_ready():
    game.jump()

Useful properties

DinoGame exposes the following useful properties:

  • load the current load of the application. If it is more than 1 it is a problem.
  • score the current score or that of the last session if the player dies.
  • time_alive the lifetime of the player.
  • frame the last game frame as numpy.ndarray.
if the_game_is_over():
    print("My score is {}".format(game.score))

Credits

This project is realized with the following python's packages:

Metadata

Release files for dino-game 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dino-game 0.3
File Size Uploaded
dino-game-0.3.tar.gz 15.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dino-game 0.3
File Interpreter ABI Platform
dino_game-0.3-py3-none-any.whl Python 3 none any Details

Total release size: 46.7 kB

Release files / dino-game-0.3.tar.gz

Download URL dino-game-0.3.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
926d58412eea082efab0ab70d6d54b58444b12047d96d2584902ef61d2287742
BLAKE2b-256 checksum
How to use checksums
091fc99feb8d7367c2bfd27ab684b3bee3e28ea254ba2485af7192adbb47d0d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release files / dino_game-0.3-py3-none-any.whl

Download URL dino_game-0.3-py3-none-any.whl
Size 31.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b520be8d6fc15311829a46ad38e4660da47d12134cb16e8f1ddbe6407bbcaad
BLAKE2b-256 checksum
How to use checksums
fa7ef2fdd303fb2db74c3edd26274c7d68ae9558f9a86e6b1ead44cadff8d7cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page