Skip to content

redanaser/Ball-Sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ball Sort Game (CLI)

Overview

Ball Sort Game is a console-based puzzle game where players sort labeled balls into tubes so that each tube contains balls of the same label. This implementation provides multiple search algorithms for solving the puzzle, including:

  • Depth-First Search (DFS)
  • Breadth-First Search (BFS)
  • Dijkstra's Algorithm
  • A* (A-Star) Algorithm
  • Hill Climbing

Features

  • Multiple algorithms to solve the puzzle
  • Customizable number of tubes and balls
  • Simple text-based input/output for interaction
  • No special strategies required to play
  • can provide statistics about performance for each algorithm

How to Run

Ensure you have Python installed on your system (Python 3.x recommended). Then, navigate to the project directory and run:

python driver.py

Game Rules

  1. Each tube can hold a fixed number of balls.
  2. You can move a ball from one tube to another if the receiving tube has space and either:
    • It is empty.
    • The top ball in the tube is of the same label as the ball being moved.
  3. The goal is to sort all balls so that each tube contains only one type of ball.

Algorithms Used

  • DFS (Depth-First Search): Explores paths deeply before backtracking.
  • BFS (Breadth-First Search): Searches level by level for the shortest path.
  • Dijkstra’s Algorithm: Finds the shortest path considering cost.
  • A Algorithm:* Uses heuristics to improve search efficiency.
  • Hill Climbing: Greedy algorithm that attempts to make the best immediate move.

Customization

You can modify the code by adjusting parameters in the code.

Contributions

Feel free to fork this project, improve the algorithms, or add new features!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages