Skip to content

Software for my derby party, to do simple parimutuel betting for winner

License

Notifications You must be signed in to change notification settings

nayfield/derbyday

Repository files navigation

A simple set of scripts for my derby day party.
   This is not for real gambling.

Requires a redis server and python-redis.  Works on RHEL6 using epel
packages.  May require modifications for newer python-redis binding
  (does not use StrictRedis)

On derby day:
1. put horses and (initial) bettors into files
2. run setup
3. point browser to tote.cgi

Optionally, seedbet can be used to bet $1 on every horse.  

When a horse is scratched, use the 'scratch' utility to remove them.

Scratched horses will print warnings that you need to refund.
Use 'betfix' to handle that.

Everything else should be self-explanitory via the web.  This was
built for some of the kids at the party to handle the wagering. They
get to keep the 'vig' (and any rounding errors).  When a bet is
placed via the cgi, the printer prints a ticket so there's something
to tear in half when your horse loses.

If you do print, you'll need a suitable printer which lpr (a2ps actually)
can print to.  Tested with a Brother QL-720NW using 54mm paper tape.

---

Changelog:

2018 - created ansible deployment role (still not checked in)
2019 - updated 1994 era cgi 'click here' after submit to 1995 era redirect
2019 - tickets so much prettier!

---

TODO:

- My first derby party was in 2000; at that time, It had been at least three years since I had written anything near cgi/HTML ... so we were writing down wagers on a sheet. In 2013 the size of the party had grown such that I needed to automate ... so I used my 16 year old HTML skills.  At least I had learned python somewhere in there.  Thus there is huge opportunity to refactor all of it.
- Make Pretty
- Even though the ansible stuff lets me determinstically deploy to a fresh OS, I'd like to run it in a single-process container (connecting to a redis container i already run)
- CUPS and printing in general sucks. when I saw brother-ql (in pypi) - I said "YES.  THIS IS WHAT I WANT!". It connects directly to the label printer ... I can get rid of depending on CUPS!  I didn't get to using it during the 3 hours I had to hack on derbyday the weekend before the party.  What I *did* do with that time, in prep for a lightweight direct printing library, was turn the ugly text tickets into good-looking graphical betting slips - which will work with brother-ql unlike the a2ps ugly I had.

- This code only sees production once a year.  Low volume.  As much as I love Redis, it's totally overkill - especially when moving to container and having an external dependency.  The right model for something with a few hours of uptime a year is to should be recreate each year by loading the field and bettors - and after the party append everything to the permanent log.
- One actual feature would be to handle scratches better.  There is an actual process here.  Field is announced (week before after last qual race?) ... Draw is tuesday before the race.  Enter the field then.  After the field is set, scratch marks a horse scratched - but still listed (can't take bets).  and possibly add an also-qualifies horse.


About

Software for my derby party, to do simple parimutuel betting for winner

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published