Computer Software Card Game

There are a wide range of software that can be used on a computer system and these can be grouped in three main categories:

  • Operating System: The Operating System (OS) is the foundational software that manages a computer’s hardware and software resources, providing a platform for other software to run (e.g., Windows, macOS, Linux).
  • Utility Software: Utility Software includes tools designed to maintain and optimise the performance of the computer, such as antivirus programs, disk defragmentation software, and file management utilities.
  • Application Software: Application Software consists of programs designed for specific user tasks, like word processors, web browsers, graphic editing software and video games, enabling users to perform activities on the computer.

For this challenge we will consider a deck of cards where each card represents a piece of software. The game will consist of randomly selecting three cards from the deck and revealing them to the player:

Based on the card selected, the player may score points as follows:

Three of a KindSplitPair
Three of a Kind: If all three software are from the same category, the player will score 100 points. This could be when three Operating System cards are revealed, or three utility software or three application software. e.g.

Split: If the first card and the third card are from the same category, the player will score 50 points. Note that the card in the middle will need to be from a different category. e.g.

Pair: If either the first two cards or the last two cards are from the same category, the player will score 30 points. Note that the remaining card will need to be from a different category. e.g.

Python Code


We have started the code by first creating three lists, each of these listing 6 different pieces of software:

OS = ["Windows 10","Linux","MacOS","iOS","Android","MS DoS"]
utilities = ["Anti-Virus Software","Firewall","Encryption Software","File Compression Software","Disk Defragmentation Software","Backup Software"]
application = ["Word Processing Software","Presentation Software","Spreadsheet Software","Web Browser","Graphic Editing Software","Video Editing Software"]

Then we are creating a full deck of 18 cards by combining all three lists into a single list.

software = OS + utilities + application

Using the random library, we can easily pick a random software card from our list of software:

import random
card = random.choice(software)

We can easily check what type of software our card by checking if it belongs to one of the three sub lists:

if card in OS:
   print(card + " is an example of Operating System.")
elif card in utilities:
   print(card + " is an example of Utility Software.")
elif card in application:
   print(card + " is an example of Application Software.")

You can check the following code below. Your task is to complete this code to implement the card game with its scoring system and making sure the player can repeat the process of picking three cards randomly as long as they wish to.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 3.3 / 5. Vote count: 32

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!