Lahore, Pakistan
← Back to Coursework

CS110 · CS110 - Programming Fundamentals

Bara Tehni

A traditional 12-bead strategy game originally developed in C++ and later recreated as an interactive browser experience using HTML, CSS, and Vanilla JavaScript.

Overview

Bara Tehni is a two-player strategy board game implemented originally as a Programming Fundamentals coursework project in C++.

The original console application was preserved in the public repository and the same game rules were recreated as an interactive browser version using HTML, CSS, and Vanilla JavaScript.

Original C++ Implementation

The C++ version uses a fixed 5×5 board with twelve beads for each player. It includes board initialization, player turns, legal movement, jump captures, additional capture opportunities, bead counting, a computer opponent, save/load functionality, and move history.

Browser Recreation

The web version translates the console-based interaction into a visual game board while preserving the original project logic.

It includes:

  • Player vs Player mode
  • Player vs Computer mode
  • Heads or tails coin toss
  • Fixed 5×5 board
  • Twelve beads per player
  • Eight-direction movement
  • Jump capture validation
  • Additional turns when another capture is available
  • Bead counters
  • No-valid-move win detection
  • Undo and redo
  • Save and load through browser storage
  • Game activity log
  • Responsive interface

Technical Approach

The original C++ board arrays and validation functions were mapped to JavaScript arrays and browser event handlers.

Console input was replaced by click-based board interaction, while the game state, movement rules, history, and computer strategy remained structured around the original coursework behavior.

Repository Structure

The public repository contains both implementations:

  • cpp/ — original C++ coursework source
  • website root — HTML, CSS, and JavaScript recreation
  • docs/ — C++ to browser feature-parity documentation

Outcome

The project demonstrates how a console-based C++ program can be preserved while also being presented as an accessible, playable browser experience.