DEV Community

Damian Beldegrin
Damian Beldegrin

Posted on

Building a Console-Based Blackjack Game in C# – Card Rendering, Clean Code and a Simple AI Bot

I've been working on a small but complete side project in C# – a playable Blackjack game that runs entirely in the console.

What started as a practice run to sharpen my .NET and clean coding skills turned into a minimal but functional card game, with some extra flair like card rendering and a basic AI bot.

Here's a breakdown of the project and what I learned along the way.


🔍 Screenshots

🎴 Title Screen

Title Screen

🃏 Example Round

Example Round


🎮 Key Features

  • Console-based, cross-platform (runs on .NET 9)
  • Unicode card rendering (text-based but visually clear)
  • Fully playable: hit, stand, dealer logic, win/loss detection
  • Simple AI bot using true count (Hi-Lo style)

🧠 Code Architecture

The code is split into logical components:

  • Program.cs: main game loop, player input, win/loss handling
  • Cards.cs: deck generation, card drawing, visual rendering
  • Bot.cs: AI logic — currently uses a basic running count to decide whether to hit or stand

The goal was to keep the structure clean and extensible, so it’s easy to maintain and improve.


📂 GitHub Repo

You can find the full source code here:

🔗 https://github.com/porzeraklon/blackjack

It's open-source and self-contained — no dependencies besides the .NET runtime.


💬 Feedback & Ideas

I'm open to suggestions and contributions — especially around:

  • Improving bot intelligence (more advanced strategy, more diversified behavior)
  • Game configuration options (e.g. changing stakes, betting)
  • GUI version later down the road

If you check it out, feel free to leave feedback or open an issue. Hope it inspires someone else working on a similar idea.

Thanks for reading!

Top comments (0)

OSZAR »