Linux Format

Update and improve old blackjack code

We’re going to take a look at an old Blackjack project and see how we can update and modify it. Blackjack is a card game where the aim is to get a value total of 21 (or closest to 21) across the cards you’re given, to win a round of the game.

The original project contains some interactive features that we can experiment with, such as buttons and events, along with some pleasing visual resources that we’ll look at in this tutorial. The original project that this tutorial is based on was created by Allan Lavell, and the original source code can be retrieved from https://github.com/bashkirtsevich-llc/PyBlackJack.

During this tutorial we’ll cover how the game program works and what resources are included for the project to work. We’ll then look at positioning elements on the screen in relation to the screen resolution that the program is running in. We’ll also add a button to the program, which will be used to exit the game.

Shuffling your cards

For this tutorial we’ll install and set up the latest version of Python (3.10). For those that have Python/PyGame already installed, Python 3.8+ should be fine. Type

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format2 min read
OBS Studio
Version: 30.0.2 Web: https://obsproject.com There are lots of good options for recording screencasts, but if you want to live-stream T your desktop, one of the best options is OBS Studio. The app works with all the major online streaming providers, s
Linux Format1 min read
Wine For Wayland
2023 was a great year for the Wayland driver for Wine. The goal was to move forward from the experimental phase and make the driver a proper upstream component. A year later, after several merge requests, many people are now already able to use the l
Linux Format2 min read
Back Issues Missed One?
ISSUE 313 April 2024 Product code: LXFDB0313 In the magazine Discover how to use the ultimate hacker’s toolkit, staying out of trouble while doing so. And join us as we take the Puppy Linux developer’s new distro for a run and explore its container

Related