Skip to main content

Horsle package

Project description

Horsle

Build Status

Note that the coverage for betting is very low as it relies on all of the other modules to function - to make it sure it has coverage it would require us to overhaul our current test suite

Required libraries: turtle, time, pandas, random, datetime

Executing the test file should run the whole program. Make sure runs.csv is in the downlaoded package.

Note that the race will only run once, but for added functionality, we may change the simulation library (turtle) so we can run games repeatedly without closing the program. Also, note that Macs have issues with the turtle library displaying the race, but it should still execute the program.

horse_race_simulator/ # package

race_data/ #subpackage1

  • horse_stats.py
    • init(self, horse_id, horse_age, actual_weight, horse_type, horse_rating, jockey_id): initialization
    • create_horse(csv_filename): creates horse stats from data set
    • update_horse_stats(self): updates horse speed based on horse stats
    • get_horse_info(self): display horses stats
  • track_data.py
    • init(self): initialization
    • create_track(self): randomly selects track venue and corresponding race distance
    • weather_factors(self): randomly selects weather factors to apply to race, which adjusts horse speed
    • get_track_info(self): displays track information
  • race_details.py
    • init(self num_horses = 5): initialization
    • set_date(self, date): adjusts race date
    • get_race_info(self): displays race_id, date, venue, distance, prize, and number of horses

simulation/ #subpackage2

  • race_simulator.py
    • init(self, race, track): initialization
    • draw_track(self, scaled_length): creates track imagery used for race simulation
    • race_setup(self): sets up race environment - prepares screen, scales track and initializes horses.
    • update_position(self): updates horse position during race, tracks progress and checks for finish. starts time and applies weather factors.
    • start_race(self): starts race via race_setup and update_position methods
    • get_times(self): returns a dictionary of race times for each horse.
    • get_winning_horse_id(self): returns winning horse ID
  • race_results.py
    • init(self, race, horses, horse_timings): initialization
    • get_horse_timing_data_frame(self, horse_timings): retrieves data frame with horse times
    • get_horse_position(self, horse_timings, horse_id): finds a horse's position at race stage
    • display_options(self): options for displaying results
    • display_leaderboard(self): displays leaderboard of race results
    • generate_race_summary(self): display the race summary
    • get_horse_performance(self): retrieves performance details for specific horse
    • various supplementary methods were included in this module for ease of functionality in the methods
  • betting.py
    • init(self, start_balance=1000): initialization
    • race_welcome(self): issues user prompts in order to begin race and proceed
    • run_game(self): consolidates the betting, race results and simulation
    • show_balance(self): shows users current balance
    • take_bet(self, bet, horse_id, horses): user input for bet - if 0 or horse_id invalid, does not accept bets
    • distribute_earnings(self, bet, winning_horse_id, selected_horse_id, odds=2.0): Assesses if selected horse wins race, if wins - adds bet to balance

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

horsle-0.0.3.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Horsle-0.0.3-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file horsle-0.0.3.tar.gz.

File metadata

  • Download URL: horsle-0.0.3.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for horsle-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4cbd0f6b04a4a326d94e02964b786021fba48a522decb8d89a2efdbcf9d756fb
MD5 39463b6c7a8f33b9e5b7283d41be234b
BLAKE2b-256 ae794507c63c13688c9449a7a1cfc43136acab2ec267b4bff1923c44502bb6c2

See more details on using hashes here.

File details

Details for the file Horsle-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: Horsle-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for Horsle-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2312f997efe5a1dd014d89fc7d26fbe651a220e255e086920a991b6b2fc75b4e
MD5 dcf2f12f695323f026fbd35c3fdc0d98
BLAKE2b-256 1a29bbb0dff5780144d45d878b312ab20304dc2fece6634df5d4ce0478b44bd7

See more details on using hashes here.

Supported by

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