Roulette banner

Roulette

21 devlogs
12h 2m 55s

A text-based game of roulette written in python. All of the standard bets of the game apply.

This project uses AI

Using chatgpt to debug issues. I also used chatgpt to list out all the possible bets, especially for 2 way bets.

Demo Repository

Loading README...

BlueCheckmate

So the shipwright found a really niche bug, so I was experimenting with ways to fix it and it turned out to be a very simple fix, just adding an and to an if statement. The bug was that if you go all in on your last sectional bet, and you still had a numerical bet, it would transfer you into the numerical bet, and you don’t have the option to not bet. Therefore, as the shipwright put it, the game was in a soft lock. I was wondering why this didnt work, and then realized that despite reassigning action to 6, it would overwrite that to 5 if the sectionalbettypecounter equaled the sectionalbettype. So then I added a comparison that if the action has been rewritten to 6, it can;t overwrite to 5, and that was in the same line, so we still finish at 3000 lines. Nice perfect

Attachment
0
BlueCheckmate

Shipped this project!

Hours: 11.69
Cookies: 🍪 37
Multiplier: 3.14 cookies/hr

And another project done, thank you spring break. Did this all in one week. You know, I’m more proud of this project than my last one, the code is more structured and easy to understand, especially the variable names. Some things I could improve upon is the repetitiveness of code, since most of it’s the same lines over and over again with the only thing changing is variable names. There’s probably a few line solution that works, but that’s ok, I’ll learn it in some other project. However, I finished on a very nice number in terms of lines of code. 3000 on the dot. perfect chefskiss. Anyways, I hope you enjoy playing this, and as always, happy gambling. agahappi

BlueCheckmate

And with that, ladies and gentlemen, we conclude our project yahoo-wahoo yay partyowl agahappi. I was going through some tedious work again, when I realized I could do it in a simpler fashion, so I reverted to the last commit, then started again. However, I had some issues with my PC, and it gave up on me and stopped showing me the buttons for committing and pushing. So that took a while to work out. Then we got it all together, and submitted this, and now it is ready for shipping. 3000 whole lines of code, to the dot. chefskiss perfect I think this code makes more sense than my last one, and is overall more organized.

Attachment
Attachment
0
BlueCheckmate

Added a remaining balance so the user can see how much they have left to bet. The last thing to do is make sure the user can’t bet 0 or under, and if they bet all their balance, it automatically directs them to the spin.

Attachment
0
BlueCheckmate

Wahoo badparrot . We finished with all the veryifying bets, and then saving the balance, and writing the new balance. All thats left is making sure the balance is positive.

Attachment
Attachment
0
BlueCheckmate

So we continue with adding payouts. I completed all of the sectional bets, whether your bet was correct or not, and we are left with doing the same thing for numbers, which should take longer.

Attachment
0
BlueCheckmate

So now we get into the payouts, It’s going to be tedious as well of . We started with rows, and will go through everything else. Pretty simple, just checks if your bet verifier is correct, which then will give you payout, and if it isn’t, then you lose.

Attachment
Attachment
0
BlueCheckmate

Holy tediousness tired . I just added that if the spin is this, then these bets are correct. Since the output has not changed, I’ll show you my code, and examples. Note the line this section starts and ends on.

Attachment
Attachment
3

Comments

evanssidhu
evanssidhu 1 day ago

If you want to get rid of tediousness here, it would help to store things like this in an array. I couldn’t help looking through your code and seeing that you did things like this a lot. It must have been really painful to code like this so for your own sanity i’d recommend looking into data structures such as arrays and also into looping structures like for loops as well.

BlueCheckmate
BlueCheckmate 1 day ago

Thank you for the feedback, it was slightly painful, but copy and paste was my friend here. As I get into more coding projects, I will look into data structures and arrays, and loops, etc.

evanssidhu
evanssidhu 1 day ago

No problem. It’s a good rule of thumb that if you find yourself repeating code a lot then there is almost always a way to do the same thing without any repetitions at all. Also as a side note the Toronto Blue Jays field model you made was really cool.

BlueCheckmate

Added the spin function, which will get us the random number. Had a bug though that it would report both numbers as red and black, so I put a in function, so now its going to tell you only one colour.

Attachment
0
BlueCheckmate

Added 6 way bets now, and we are now done with betting! yay . Now we need to move onto the spin, and then what each possible number means which bet is possible, which is also going to be very tedious pf

Attachment
0
BlueCheckmate

Now with the 4 way bets. This is taking quite a bit of time, but at least there are no bugs that I’ve found, which has saved me some time. yay

Attachment
0
BlueCheckmate

Continuing with horizontal 2 way bets, after this only 4 bet corners remain and 6 way 2 rows

Attachment
0
BlueCheckmate

Continuing the same thing with 2 way bets, and only the vertical ones. My eyes are gonna bulge out from the repetitiveness. At least there aren’t any bugs.

Attachment
0
BlueCheckmate

Holy tediousness. Sucks that I’m a beginner coder, what I just did there was probably a much more simpler way, but at least this code is more neat than my last code and the structure makes more sense. Gotta learn step by step, it’s a process guys. Anyways, I added single number betting, almost no bugs though. I’ll show you a sneek peak of my code just to see how much it was. Obviously, I’m not dumb enough to write the same thing 37 times, I copy pasted the format, and filled it in accordingly with the number, but just look at how much code.

Attachment
Attachment
Attachment
0
BlueCheckmate

So before I even got the chance to start the number type bets, I encountered a bug that it wouldn’t switch from sectional to number, I think I had some logic errors of when I would subtract the counter, so I erased all counters and only added when they made a valid bet.

And I also encountered another bug sad2. Even if I inputted a correct answer and made a bet, there would still be a line saying my answer isnt properly written, but I changed everything to if elif….. else, and now it works fine yay2

Attachment
0
BlueCheckmate

I finished with the sectional bet types blobcheers . Added the High/Low option, and made sure that it re-prompts you if you make a mistake in what kind of sectional bet you want to make. I will need to go back and make sure you can’t overbet, or bet 0, and I should probably add a contingency that if you bet all your remaning balance, it skips to the spin part.

But now we get to fun part depression I need to do the same thing for the number section, and that’s going to be majorly repetitive.

Attachment
0
BlueCheckmate

Got the odd/even and red/black working as well with no bugs on the first try yay . I also figured out how to commit and push directly from pycharm, which is an advancement for me. glados-potato. Got the one from yesterday, and the one from today on there.

Attachment
Attachment
0
BlueCheckmate

Continuing with the thirds. No bugs this time yay. I’m getting better agahappi Looks a little too much time spent, but had some trouble with hackatime and wakatime after the new update, and my antivirus protection decided to block the wakatime exe, so I was troubleshooting that, got it to work, and it added a few minutes.

Attachment
0
BlueCheckmate

Onto the columns now for sectional bets, along with a little debugging for both columns and rows. Something new from my previous project that I’m trying to implement here is that if you screw up an answer, it will still allow you to play, unlike my last project. So now with the rows and columns, if you answer incorrectly, the bet counter would think you made a bet, but you actually haven’t, so I fixed that quickly by removing a tally. It might be inefficient but it works. I’d also get an incorrect response even if I put a correct response because I used or instead of and in determining what a wrong answer is.

Attachment
Attachment
0
BlueCheckmate

Moving onto bets for the sectional type, I started with rows. This was very repetitive, as I had do the same lines for all 13 rows, which I just copy pasted the same format. I also created the function for making sure you can only make 6 types of sectional bets, and making sure that it records when you add a bet. I’ll show you a picture of how repetitive my code became. We will need to go back into it and make sure that you cant bet 0 or overbet.

Attachment
Attachment
0
BlueCheckmate

Created the opening question of if you want to play, and what types of bet you want to make. I currently only have sectional and number specific bets, but will branch off into each individually. I didn’t get much done cus I was testing what I currently have to make sure everything’s ok before I move into the next part, and encountered a bug where if I didnt input 1 or 2 for types of bet, it would continuously loop the saying that it needed to be a 1 or 2. Fixed this after figuring out that the question was a couple lines early, and something went wrong, so I moved the question down a couple lines, and it started to work fine.

Attachment
0
BlueCheckmate

Time to start a fresh project. We will be creating a text-based roulette game. Right now, I just started the intro, with the balance writing and saving functions, as well as the intro and rules text.

Attachment
Attachment
0