Bettor's Box

So I bought a second Arduino Uno today. The first one I use to tinker and practice stuff with.

The second, I want to make a betting odds calculator.

I have a TFT Touch Shield, an Ethernet Shield, an SD Card Shield, and the Uno.

Does anyone know how I could make a simple calculator for betting odds. I want to put in the odds formula with overround calculation. (Gotta make that money somehow, or in this case, Magic cards.)

As I touch a button or press a physical button to register players as winners or losers, the odds change accordingly. Even if it's just one player kept track of and I use two buttons (one for wins, other other for losses), I would love this.

Here is the odds formula and I can always just add something to it to cover the overround:

this is the 'project guidance' forum.

here we offer suggestions to make your project work.

to that end, your project can work. done. you can mark, [ resolved] on this thread.

seems like you have a complete software or programming
if you want help programming, I would offer that the guys who hang out in the programming forum will be able to give you some guidance.

but, I would offer that at the top of every forum there is a sticky of how to use this forum.
if you do not want a bunch of smart arse posts (kinda like this one) you would be best to read that and especially learn about code tags.

Okay, so I am hoping for some direction to start here. I bought “Getting Started with Arduino” and can do the basics in it.

I will try to describe in, as much detail as possible, what I am trying to do. I will preface this with a disclaimer: I do not know what I am doing. I can blink an LED and do basic stuff like that, but that’s my limit.

What I need are some tips on where to start. I am a project-based learner so that’s how I intend to learn: Learn as I go.

I want to build a box that, when I press a red momentary switch, it will add +1 to my relative win count. If I press a black momentary switch, it will add +1 to my relative loss count.

I say “relative” count because I want to eventually add a code to the programming that will calculate odds for me. I know the formula for odds, I just don’t know how to teach it to the Arduino.

I want to make a box that will keep track of my wins and losses. The number of wins and losses will be displayed on the TFT Shield that I have, along with my odds of WINNING. I only capitalize that because odds can be expressed in terms of winning odds or losing odds.

I have an Arduino Uno connected to an SD card shield with an 8 GB SD card and a TFT Shield. I want to log my data from my wins and losses to the SD card so I can measure trends of winning and things like that.

I would appreciate any help anyone can offer.

No, I didn’t post any code because, like I said, I can blink an LED and that’s about it.

Here is the formula for odds if that helps:

Doing math in a program is a lot like doing math on a calculator. If you have a variable that's holding this P value, then you can do your calculation just like this.

int odds = P * (1 - P);

It's really just that simple.

Now, if you can express that mathematically with the number of wins and losses, it should be fairly trivial to put that into code.

Can you write the expression in math terms?

Thank you for your reply.

So it would be:

Odds = # of Wins / # of Losses where number of wins is variable X and number of losses is variable Y.

Is that right?

How do I create a variable that increases with the touch of a button?

Thanks again for your help and patience.

Munchaus:
How do I create a variable that increases with the touch of a button?

Thanks again for your help and patience.

Since you seem to like to learn by doing, try looking at some of the examples that come with the IDE. Look specifically at the state change example. Only instead of lighting an LED, you'll be increment a variable.

You might want to look at a few basic C++ tutorials too. There are thousands on the web. That will help you understand the basics of creating and using a variable.

One letter variable names are bad, many of them are reserved. Give them real names.

wins = wins + 1;

or the shortcut version

wins++;

will add 1 to your variable.

Once you get something going, come post it here if it doesn't work right and we'll help you get it fixed.

It should be noted that the probability (and therefore the odds) of winning are not related in any way to the number of wins or losses that you have experienced. Probability is related to the total number of possible outcomes and the number of those that would win.

For example, if I were to roll a single 6 sided die and say 1, 2, or 3 lose and 4, 5, and 6 win. It doesn’t matter one little bit that I just rolled three 6’s in a row. The probability of winning on the next roll is still 50%.

Essentially identical questions merged.

Hi,
Using OP's equation for odds;

int odds = P * (1 - P);

should be

int odds = P / (1.00 - P);

Divide not multiply and you may have to float if p is probability.

Tom.... :slight_smile:
Shoot me if I'm wrong.