DEV Community


Posted on

Demo Highlight: Acey-Deucey

It's time to highlight another of the Mini Micro built-in demos. This one is, I suspect, underappreciated because it is text-based. You won't find any fancy graphics here, and only minimal sound effects. And if you're not already familiar with the game, you have to read a few lines of instructions. I suspect we lose many potential players at that point (because, as a general principle, users don't read).

But let's dig deeper. There is more potential here than you probably realize.

The Game

Fire up Mini Micro, and run "/sys/demo/acey-deucey". (Or if you like, play it on the web right now!) Brief instructions are printed, and then the game begins.

Acey Deucey is a simple card game in which two cards are dealt, and then the player bets on whether a third card will fall between the first two.

Screen shot of Acey Deucey in progress

On each round, you can choose to bet (any amount) that the next card will fall between the first two; or decline the bet, though in this case you will still lose your $2 ante. The game continues until you either run out of money, or choose to quit.

The Mini Micro version makes use of card-suit characters to display the cards, like Q♠ (queen of spades) and 5♥ (five of hearts). The card suit doesn't actually matter in this game, but it provides nice flavor.

Shallow Opportunities

This simple text-based game contains some great learning opportunities. Let's go for the easy and obvious first:

The entire demo is only 135 lines of code. So you should absolutely read through it (I know, I know, users don't read, but you're a programmer and you do read, at least when it's code!). Among the things you may learn just from reading the code:

  • how to "mock" the Sound class so that the same code can work in Mini Micro (with sounds) and in command-line MiniScript (without)

  • how to access those nifty card-suit characters in code

  • how to represent a standard deck of 52 cards (including shuffling, dealing, and discarding cards)

  • how to do input validation (preventing the user from betting a negative amount of money, or more than they have)

These are useful skills and techniques you can immediately apply to your own programs.

Deep Opportunities

But there's a much deeper learning opportunity here:

Add a graphical user interface to this game.

This program is just begging for some code to draw the cards. Mini Micro even has playing card images built-in!

Screen shot showing how easy it is to load and draw a playing card in Mini Micro

Simply drawing the two initial cards before your bet, and then the third card after, would make this a dramatically more appealing game. As a beginner Mini Micro programmer, this would teach you a great deal about the Mini Micro API: how to load an image from a file, how to draw an image to the screen, how to clear the screen for the next round. And if you're an experienced programmer, this is something you could do on your coffee break, and feel the satisfaction of having turned a 1970s-style text-based game into a 1980s-style graphical one!

As far as I am aware, nobody has ever done this.

I've been waiting for years for somebody to see and seize this opportunity, and post a screen shot in the #show-and-tell channel of the community Discord to receive the accolades they deserve. But it's never happened.

So, here's your chance. Who will be the first?

Top comments (0)