Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • Announcements

    • Lizzy Trickster

      Latest Stable OpenComputers Version   11/26/16

      The latest released version of OpenComputers is version 1.7 for MC 1.7.10, 1.8.9, 1.9.4, 1.10.2, 1.11.2 & 1.12.1. See more information here! Beta/Dev builds can be found at the Jenkins Build Server (ci.cil.li)
TuxMan20

Blackjack game inside OpenOS [WIP]

Recommended Posts

Hey there,

I figured I'd share how my project is advancing.

I realized that for a computer within a game... there really was a lack of games :P If you ever wanted a way to chill while you wait for your 8 High Powered Solar Arrays to craft... here's  a solution!

The game works and plays but it's still a work in progress as there is still no type checking when users enter a choice (entering a letter when the program wants a number makes it crash, for exemple). The credits are not saved in a file for persistence yet. Finally, I stil haven't completed the split mechanics (When you receive two equal cards as your first cards, you can split them to play two hands). Implementing it will require 4 tables within a table within a meta-table, and I'll have to rework A LOT of functions to take into account the number of hands a player can have (dealing cards, placing bets, ending the turn, comparing against the dealer, etc.... ). 

One aspect that I liked is the shuffling. You will see inside the code, the deck never gets shuffled. I struggled to find a good shuffling algorithm when I came to the conclusion I didn't need one. The reason is simple: it's not a real deck of cards. Instead of finding a way to shuffle data inside a table, and picking the first one out, I figured it made WAY more sense to simply pick a card inside the table at random. Saved me an evening of work ;)

So, I hope you enjoy it! :D 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×