Facebook Twitter Instagram Pinterest YouTube
    Trending
    • Add Kodi to RetroPie Menu
    • Disable Auto-login in Raspberry Pi OS
    • Raspberry Pi Cloud Storage with MEGA
    • RetroPie Temperature Monitor from Menu
    • Pi Pico Pinout and Power Pins
    • Install Arduino IDE on Raspberry Pi
    • Raspberry Pi 400 SSD Upgrade
    • Raspberry Pi Temperature Monitoring
    Facebook Twitter Instagram Pinterest YouTube RSS
    Raspberry Pi SpyRaspberry Pi Spy
    • Home
    • Categories
      • General
      • Hardware
      • Programming
      • Python
      • Software
      • Tutorials & Help
    • BerryClip
      • BerryClip Instructions
      • BerryClip Plus Instructions
      • Videos & Reviews
    • Buy
      • Buy Pi
      • Buy Pi Accessories
      • Buy Books
    • Tools
      • Ultimate Raspberry Pi Alexa Skill
      • Pi Power Estimator App
      • Pi-Lite 14×9 LED Matrix Sprite Editor
      • RPiREF Pin-out Reference App
      • Simple Ohm’s Law Calculator
      • Web Sites & Links
    • Tutorials & Help
        Featured
        November 9, 20200

        Raspberry Pi Temperature Monitoring

        Recent
        May 6, 2022

        Add Kodi to RetroPie Menu

        February 26, 2022

        Disable Auto-login in Raspberry Pi OS

        February 2, 2022

        Raspberry Pi Cloud Storage with MEGA

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Hardware»BerryClip»Berry Bookies – A Horse Racing Game For The BerryClip
      Berry Bookies Horse Racing Game

      Berry Bookies – A Horse Racing Game For The BerryClip

      0
      By Matt on January 24, 2014 BerryClip, Python, Software

      Jim Flewker, a retired languages teacher, has written a horse racing game in Python for use with the BerryClip addon board. In the game you select one of six horses using the BerryClip button and then wait for the result of the race.

      The result of the race is shown on the command line and via the BerryClip’s 6 LEDs.

      If you are lucky your pot of virtual money will grow … but beware … the bookie always wins in the end!

      In Jim’s own words …

      Simple horse racing simulators have been around forever – no claims to originality!

      – 6 horses in every race, each with appropriate name and odds
      – “cyclical” betting routine uses Berryclip LEDs and switch
      – fixed bet amount (can be changed in the code)
      – simple race progress display in Shell and also via Berryclip leds
      – totally random winner
      – race until you get fed up or run out of funds
      – final feedback

      I’ve learned quite a bit so far and had a lot of fun – thanks, Matt!
      Still a raw beginner, so if anyone reading this has any tips for improvements, please email me: jim@dastor+org+uk (replace plus signs with full stops/periods).

      Jim confesses to having no technical background or qualifications and started this project to have a go at programming and soldering. His weapons of choice were a Pi, a BerryClip and Python.

      Berry Bookies Horse Racing Game

      Installation

      To install the script you can either grab the file directly :

      wget https://bitbucket.org/MattHawkinsUK/rpispy-berryclip/raw/master/berry_bookies/berry_bookies.py

      or download the complete set of BerryClip example scripts as described on the BerryClip Instructions page.

      The game can be run by using :

      sudo python berry_bookies.py

      Instructions

      When the game starts it will present a list of horses and their odds as shown below :

      --------------------------------------------------
      HORSES AND ODDS FOR THIS RACE
      --------------------------------------------------
      Jess of Greendale at 8-1
      Miss Moss at 11-1
      Daffy Dill at 15-1
      Captain Custard at 3-1
      Raspberry Pie at evens
      Ruddy Miracle at 7-1

      It will then start to list the horses. Press the BerryClip button when your chosen horse is displayed.

      Once you’ve chosen a horse the race will begin!

      --------------------------------------------------
      Horse is Miss Moss.
      Odds for this horse are: 11-1
      To bet on this horse, press the BUTTON while its light is on.
      Otherwise, just WAIT for the next horse!
      You placed a bet on Miss Moss, horse number 2.
      --------------------------------------------------
      RACE NUMBER 1
      Your current funds: 90
      THEY'RE OFF!
      5/>
      5/> 1/>
      5/> 1/> 5/>
      5/> 1/> 5/> 6/>
      5/> 1/> 5/> 6/> 6/>
      5/> 1/> 5/> 6/> 6/> 6/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/> 3/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/> 3/> 2/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/> 3/> 2/> 2/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/> 3/> 2/> 2/> 1/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/> 3/> 2/> 2/> 1/> 5/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/> 3/> 2/> 2/> 1/> 5/> 1/>
      5/> 1/> 5/> 6/> 6/> 6/> 1/> 5/> 1/> 6/> 3/> 2/> 2/> 1/> 5/> 1/> 6/>
      HORSE 6 WON
      --------------------------------------------------
      The winner was Ruddy Miracle
      Winning odds were 7-1
      A bet on the winner won 80 including stake.
      Better luck next time.
      --------------------------------------------------
      Funds: 90
      Bet on another race y/n?n
      --------------------------------------------------

      At the end of the race you will have the chance to bet on another race. Will that lucky streak last or will you hope for a change of fortune?

      Thoughts

      This script has plenty of scope for modification to improve the game play. Here are some ideas for updating the script :

      • Allow the player to choose a stake
      • Randomly generate the horse names
      • Allow multiple players
      • Adjust the maths to change the race outcome
      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticleHolux Bluetooth GPS Module And The Raspberry Pi
      Next Article DigiMakers Bristol – 1st February 2014

      Related Posts

      Disable Auto-login in Raspberry Pi OS

      Raspberry Pi Cloud Storage with MEGA

      Raspberry Pi 400 SSD Upgrade

      Leave A Reply Cancel Reply

      This site uses Akismet to reduce spam. Learn how your comment data is processed.

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      January 7, 2022

      RetroPie Temperature Monitor from Menu

      January 24, 2021

      Pi Pico Pinout and Power Pins

      Categories
      • 1-wire
      • 3D Printing
      • Add-ons
      • BBC Micro:bit
      • BerryClip
      • Books
      • Camera Module
      • Cases
      • Events
      • General
      • Hardware
      • I2C
      • Infographics
      • Interfaces
      • Minecraft
      • Model A+
      • Model B+
      • News
      • Pi Models
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      3D Printing Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter LCD LED Linux media Minecraft Model A Model B motionEyeOS PCB photography photos Pi-Lite portable power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI temperature ultrasonic video
      Raspberry PI Related
      • Adafruit Blog
      • Average Maker
      • Official RaspBerry Pi Site
      • Raspberry Pi Pod
      • RasPi.tv
      • RaspTut
      • Stuff About Code
      Tech Resources
      • MattsBits – Pi Resources
      • Microbit Spy
      • Technology Spy
      Archives
      About

      Unofficial site devoted to the Raspberry Pi credit card sized computer offering tutorials, guides, resources,scripts and downloads. We hope to help everyone get the most out of their Pi by providing clear, simple articles on configuring, programming and operating it.

      Popular Posts
      September 19, 2014

      Top 5 Reasons The Raspberry Pi Sucks

      July 27, 2012

      16×2 LCD Module Control Using Python

      October 20, 2013

      Analogue Sensors On The Raspberry Pi Using An MCP3008

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      Facebook Twitter Instagram Pinterest YouTube RSS

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2022 - All Rights Reserved - Matt Hawkins

      Type above and press Enter to search. Press Esc to cancel.