Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Bitboard Checkers Simulator

A console-based checkers game engine built in Java using bitboard representation — a technique used in real-world game engines (including chess engines) that encodes the entire board state using 64-bit integers and bitwise operations for efficient move computation.

What It Demonstrates

  • Bitboard representation — encoding two player boards as 64-bit long values, initialized using hex patterns (e.g., 0xAA55AA) to place pieces at correct starting positions
  • Bitwise operations — using bit shifting (<<, >>), masking, and XOR to manipulate board state without traditional array structures
  • Legal move validation — boundary checking and occupancy detection to prevent invalid moves
  • Capture logic — detecting jumped pieces and removing them from the opponent's board based on turn state
  • Type safety — resolving int/long type mismatch issues that arise when working at the bit level in Java
  • Custom utility class — modular bit-level operations (set, clear, toggle, shift, convert to binary string) used throughout the engine

Features

  • Two-player turn-based checkers on an 8×8 board
  • Legal move enforcement (boundary and occupancy checks)
  • Jump/capture detection and piece removal
  • Console board rendering via formatted for-loop output
  • Scanner-based interactive game loop with turn prompts and game state display

Language & Tools

  • Language: Java
  • IDE: IntelliJ IDEA
  • Concepts: Bitwise manipulation, OOP, game state management

How to Run

Prerequisites

Steps

# Clone the repository
git clone https://github.com/JonahGardin48/Bit-Board.git
cd Bit-Board

# Compile
javac BitBoard/*.java "Utility Class"/*.java

# Run
java BitBoard.Main

Note: File paths may vary depending on your system. Open in IntelliJ for the easiest setup — just run the main method directly.

Known Limitations

  • Kinging is not yet implemented — pieces do not promote when reaching the opposite end of the board
  • Backwards movement restriction is enforced but kinging logic is an area for future development

What I Learned

This project required a genuine learning curve around how Java handles long primitives at the bit level — specifically understanding that Java auto-initializes longs to 64 bits, the behavior of signed vs. unsigned shifting, and how to maintain consistent type handling across a utility class used by many other methods. The board initialization pattern using 0xAA55AA was a satisfying discovery that reduced what seemed like a complex setup into a single elegant constant.

About

Console-based checkers games engine using bitboard representation and bitwise operations in Java

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors