GithubHelp home page GithubHelp logo

maxim-mazurok / gtao-betting Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 18.48 MB

Testing strategies of betting on horse races in GTA Online. Calculating adjusted advantage compared to the odds and using Kelly Criterion to determine bet size, then simulating games.

TypeScript 77.75% Python 14.75% HTML 7.50%
betting gambling gta5 horse-racing kelly-criterion odds-calculator

gtao-betting's Introduction

[WIP] GTA 5 Online Betting Strategy

Testing strategies of betting on horse races in GTA Online. Calculating adjusted advantage compared to the odds and using Kelly Criterion to determine bet size, then simulating games.

Also automates betting in the game using python. Game is expected to run in Windowed mode with 1280x1024 resolution and English language.

Both are working, but still work in progress.

Getting Started

  1. git clone https://github.com/Maxim-Mazurok/gtao-betting
  2. cd gtao-betting

Simulation

  1. nvm i - optional
  2. npm ci
  3. npm test

Automation

  1. cd automation
  2. pip install -r requirements.txt
  3. python main.py

See also my personal spreadsheet: https://docs.google.com/spreadsheets/d/1z27GEyrFVnBBZcCJ-w2QDZS9LKDiZfK2wvD02UxifzE/edit?usp=sharing

Credits & Prior Art

Notes

  • Seems like the game doesn't actually use suggested chances adjustments. For example, for 371 games, the average adjusted odds for evens were 48% but the actual win rate of evens was 65%, see Podium Frequency Chart - 2
  • It looks like adjustChancesToFirstHorse + getXthFavourite(0) results in Adjusted Expected Wins to follow Actual Wins. But it doesn't work with getBetKelly, so maybe I figured out how to calculate odds for the first best horse, but not for the rest. Maybe try a strategy that re-allocates chances per group?
    • It seems like who you bet on will affect the winner. Need to run actual tests
      • Ran tests betting on the 3rd fav. It did win much, but it did shift odds for the 2nd category (3rd and 4th faves) from the 1st category (1st and 2nd faves). When simulating 1st fav strategy on that data - it ends up loosing a lot, unlike when testing on the fav 1st data.

ToDo

  • Try calculating average adjusted odds for each horse based on all possible combinations in the game? Doesn't make much sense tho because the adjustment doesn't seem to be used by the game

gtao-betting's People

Stargazers

 avatar

Watchers

 avatar  avatar

gtao-betting's Issues

Fixed chances?

We know that when we add up all odds in a given race in gtao they don't add up to 100%. ChatGPT 4 suggested that one of the possible solutions to this would be to use fixed chances for each horse. This means that just like each horse have fixed odds, they could also all have fixed chances of winning. I don't really think that it's easy to implement, because then it would probably limit the combinations. Unless all horses in each group (favourites/underdogs/etc) have the same chances, which doesn't seem to be true based on stats I've seen. Nevertheless, an interesting thought, maybe it can be shaped into something promising.

Randomness check for Apollo on FiveM

In here https://docs.google.com/spreadsheets/d/1z27GEyrFVnBBZcCJ-w2QDZS9LKDiZfK2wvD02UxifzE/edit#gid=1587400911
I was checking how randomness works in custom implementation of inside track in FiveM on Apollo server.
I was recording winning odds in each race, and they using chi square to evaluate chances of those wins being in line with declared horse chances. Basically I wanted to check if it's totally random, or if horse chances actually are taken into account.
And I can see with my eyes that yes, they are most likely are taken into account.
And I also can see that chi square value for horse wins has much less than 0.5% chance of being completely random.
But it also has less than 1% chance of being in proportion to the horse chances, which seems unintuitive...
Maybe I'm calculating chi square wrong? Maybe 200 games is not enough?

Maybe it has something to do with expected frequencies being less than 5, which is kinda rule of thumb to make sure that chi is accurate?...

What should I bet if Kelly says to bet more than maximum allowed bet?

Let's say I have 150k and so Kelly says to bet 16k, but the maximum bet is 10k. What should I do?

  • Just do max allowed bet? But then I'll be betting the same for different expected returns, doesn't make much sense...
  • Do I lower my bankroll so that Kelly's bets don't exceed the maximum bet? This seems to make sense, but might not provide that great grow rate... I had to find it experimentally, but there must be a formula for this.

Why betting on the best horse always beats betting on the worst horse?

I ran experiments, and betting on the best horses always returns amazing results. While betting on the worst horses leads to very small gains even over the very long term. I don't understand why... In theory, playing 1/1 game to infinity should be the same as playing 100/1 game to infinity. Payouts should be approximately equally weighted depending on the horse's chances of winning. Need to look into it, I kinda suspect there might be a bug in my code. Or maybe the game is just designed/rigged for this disbalance?

Lost all chips 24mil to 19 chips

I had around 24 mil chips, was playing horse racing, after a few hours got temporary ban on betting (as usual, I think it's a third one so far), but this time also most of my chips were gone (only 19 left).
Maybe it's because of high balance, but people online claim to have 77mil chips.
Restarting game didn't help.
Buying more chips helped to restore the balance.

Explore stats for the same races

Now that we are getting more and more data, it can be interesting to try looking for the same race lineups.
Basically find the same race lineups (same odds, or same horses, or same order) and do some stats on these.
This way we might be able to see a pattern of how the distribution of chances is happening for a given race lineup.

Already did this before, but there was not enough data, now it might be time to revisit this idea.

Casino ban

I was betting 10k on the best horse for a while. Went from 200k to 1mil, then in ~430 games I went from 1.1mil to 2.5mil.
And now I'm getting "This feature is not available now. Please come back later." message and can't bet anymore.
It seems to be a temporary ban (maybe 7 days), see https://www.reddit.com/r/gtaonline/comments/ckttbz/this_feature_is_not_available_now_please_come/

I'm not sure if it's based on winnings, time spent, chips spent, or anything else. But If it's based on winnings - Rockstar did it again, very realistic :)

What is the best bet when Kelly says not to bet at all?

Sometimes there are situations when the house wins in any case, there's no edge. What is the best strategy in this case?

  • Just stop playing? Probably not, missing out on all those cases when a player has an advantage. Actually does player has advantage on average?
  • Just bet minimum bet on the bet with the highest probability? But then we also giving out the most advantage in %...
  • Bet the minimum bet on the highest Kelly option? This should probably give the best results, if we're betting on option that has the highest expected rate of payout over the long run. But I'm not sure. From my simulations it looks a bit weird...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.