Welcome to my C++ Games

This contains my C++ Games, which I’ll continue to expand as I improve. I love making simple little games, so feel free to explore the code on the links that I will share for each one.

1

Tic Tac Toe

An interactive, text-based maze navigation program demonstrating structured data, user input handling, and simple collision detection:

Maze Representation
The maze is a 10×10 grid stored as a vector<vector<char>>, where '#' denotes walls and ' ' open paths.

Player Struct
A Player struct holds x and y coordinates, initialized at (1,1).

Rendering Function
displayMaze() iterates over the grid, drawing either the maze cell or a 'P' at the player’s current position.

Movement Logic
movePlayer(direction) computes tentative coordinates based on w/a/s/d input, checks for open space, and updates the player’s position if the target cell isn’t a wall.

Main Loop
Continuously renders the maze, prompts for direction, applies movement, and clears the console for real-time navigation.

This project highlights dynamic data structures, control flow, and basic game-loop architecture in C++. Find Here!

2

Simple Console Game

A compact, two-player Tic-Tac-Toe game implemented with clear, modular functions and robust input handling:

Board Representation
A 3×3 char array labeled ‘1’–‘9’ lets players pick moves by slot number. Each turn redraws the grid via drawBoard().

Core Logic
placeMarker(slot): Converts a slot to row/column indices, checks occupancy, and places the current marker.
winner(): Scans rows, columns, and diagonals for three identical markers, returning the winning player or 0.
swapPlayerAndMarker(): Toggles between Player 1 and Player 2 along with their markers (X/O).

Game Flow
In game(), Player 1 first selects X or O. The loop runs up to nine moves, prompting for valid slots, rejecting invalid or occupied entries, and ending early on a win. Finally, it declares the winner or a tie.

This project showcases procedural design, input validation, and user interaction in C++. Find Here!