Baccarat

Post Reply
tallLeRoy
Posts: 3
Joined: Fri Mar 08, 2024 3:45 pm

File Download Baccarat

Post by tallLeRoy »

Screenshot 2024-03-10 at 10.04.44 AM.png
Screenshot 2024-03-10 at 10.04.44 AM.png (721.71 KiB) Viewed 507 times
Baccarat is a game with some development history. It began as a BASIC game in the book 'More BASIC Computer Games' Edited by David H. Ahl and published by Workman Publishing New York in 1979.

I took the BASIC program on page 4 and 5 and translated it into Prog8 for the X16. The translation replaced all of the goto statements with control statements in Prog8. All of the numbers were converted to 8 or 16 bit integers in that first step.

The second step was to untangle the single block of code into more manageable smaller blocks of code in Prog8. Things naturally fell into blocks for cards, the shoe, hands, player, banker, dealer, gambler, guests ... etc. I called this an 'object-oriented' type of coding in Prog8. This object-orientation is in style only; Prog8 is does not have object-oriented assistance built in.

The third step was to add all of the rules required for a full casino game that were left out of the BASIC program. This version complies with rules set by the Massachusetts gaming commission. I needed to create a 32 bit math library for the dollars and cents needed in the game. Prog8 does not include 32 bit math. (Floats provided the wrong answer sometimes.)

I needed the help of MarkTheStrange on the Prog8 Discord Channel to create sprites for the 12 royal card faces shown in the game. These were created as sprites and were placed over the text card faces in the game. Sprites are also used for the corners of each card to get two colors with transparency.
Screenshot 2024-03-10 at 10.22.50 AM.png
Screenshot 2024-03-10 at 10.22.50 AM.png (900.62 KiB) Viewed 507 times
The final steps were to harness to power of the VERA to create animations and scroll only the lower half of the screen.

I found Prog8 offered the right combination of flexibility and speed to create this program. It was a good choice. It did not include all of the libraries needed for the final program, but offered facilities needed to create them. DesertFish on the Prog8 Discord Channel has been very supportive in bringing this program to the current state.

#R47

baccarat.zip
(24.73 KiB) Downloaded 5 times

Try It Now!

Place both files in the same folder to start the program.

Check out the instructions when starting out. You can do a lot of different things at the BET? prompt.

I like to create multiple gamblers and assign different betting strategies to each, automate a few hundred games and see which strategy worked best for those shoes. One thing for sure is that the house does not lose money in the long run. But an individual can win, depending on the cards in the shoe.

The eight decks in the shoe are shuffled six times using the Fisher-Yates algorithm in both ascending and descending form. Over 2400 random numbers are used for each shoe. The results are pretty random.

Have fun with it.

tallLeRoy
Last edited by tallLeRoy on Sat Apr 27, 2024 4:25 pm, edited 4 times in total.
tallLeRoy
Posts: 3
Joined: Fri Mar 08, 2024 3:45 pm

Re: Baccarat

Post by tallLeRoy »

Confirmed for R47
funkheld
Posts: 265
Joined: Mon Feb 26, 2024 11:11 am

Re: Baccarat

Post by funkheld »

wonderful.

Can you please post the source code of pro8 here?
then you can learn from it.

greeting
Post Reply