Console Based Card Game

Strategic C# console game built using object-oriented programming, AI decision logic, and file logging.

=== CARD GAME ===
Player: John [8, 12] → Diff: 4
Bot: AI [5, 7] → Diff: 2
🎉 BOT WINS! 🎉
Play again? [Y/N]

Project Overview

Strategic two-player card game where competitors aim to minimize the difference between their two number cards. Players strategically decide whether to keep their current cards or swap one for a new random card. Features intelligent AI opponent, comprehensive logging, and replay functionality.

Strategic Decision Making

Players analyze card differences and make calculated swap decisions.

Intelligent AI Opponent

Bot uses sophisticated decision logic for optimal gameplay.

Complete Logging System

Automatic session logging with timestamps for analysis and debugging.

Core Features

Sophisticated gameplay mechanics and robust software architecture

Strategic Gameplay

Players must analyze card differences and make optimal stick/swap decisions.

AI Decision Logic

Intelligent bot analyzes risk/reward and makes strategic card swaps.

OOP Architecture

Classes, inheritance, encapsulation, enums, and modular design patterns.

Logging System

Automatic timestamped log files track every decision and game outcome.

Input Validation

Robust validation prevents invalid inputs and enhances UX.

Replay System

Instant rematch functionality for continuous gameplay sessions.

Game Workflow

Complete gameplay cycle from initialization to replay

1

Game Initialization

Welcome screen and player name input

2

Random Cards

Generate initial card pairs for both players

3

Player Decision

Choose Stick or Swap with strategic analysis

4

AI Bot Move

Bot analyzes and executes optimal decision

5

Round Results

Calculate differences and display scores

6

Game Complete

Announce winner with tie-breaker logic

7

Log Generated

Save complete session to timestamped file

8

Replay Prompt

Offer instant rematch option

Console Experience

Clean console interface with strategic gameplay displays

Welcome Banner
Enter your name to start...

Welcome Screen

Game initialization and player setup

Player: John [7, 12]
Difference: 5
[S]tick or [W]wap? → W

Player Turn

Strategic decision making interface

Bot: AI [4, 9]
Difference: 5 → Analyzing...
→ SWAP executed
New: [4, 6] → Diff: 2

Bot Decision

AI strategic analysis and execution

🏆 PLAYER WINS! 🏆
Final Score: 2 vs 4

Final Results

Victory screen with scoring summary

[2024-01-15 14:32:10] GameSession_001.log
Round 1: Player swap → [7,9]
Bot swap → [4,6] WINNER: Bot
Complete session logged

Game Log

Comprehensive session logging output

Great game!
Play Again?
[Y]es / [N]o

Replay Prompt

Seamless rematch functionality

AI Bot Intelligence

Sophisticated decision-making algorithms for competitive gameplay

Risk Analysis

Bot calculates current difference vs potential swap outcomes before deciding.

Strategic Swapping

Prioritizes swapping higher-value cards when difference exceeds threshold.

Tie-Breaker Awareness

Considers total card values for tie-breaker scenarios in decision logic.

Conservative Play

Avoids unnecessary swaps when current difference is already optimal.

Advanced Logging System

Professional-grade session tracking and debugging capabilities

Documents/CardGame/

Automatic File Creation

Each session creates timestamped log:
GameSession_2024-01-15_143210.log

Complete Tracking

Logs every swap, round result, player decisions, and final winner determination.

Debugging Ready

Structured format enables easy analysis, testing, and performance review.

Tech Stack

Modern C# console application architecture

C# .NET Console Apps OOP File I/O Enums Inheritance AI Logic Validation Classes

Interested in Custom Software?

Looking for game development, AI logic systems, or console applications?

Contact Me Back to Portfolio