Skip to content

huynna12/Sudoku-App

Repository files navigation

Sudoku App

An Android Sudoku game built with Kotlin, Java, Jetpack Compose and Firebase.

Live Demo

🎮 Play it in your browser on Appetize.io


Screenshots

Home Login Sign Up
Lobby Difficulty Game
Reward Leaderboard Profile

Features

  • Three difficulty levels — Easy, Medium, and Hard, each with a unique puzzle guaranteed to have exactly one solution
  • Guest & account play — play instantly as a guest or create an account to unlock more features
  • Save & resume — unfinished boards are saved locally and synced to the cloud for logged-in users
  • Leaderboard — compete with other players on ranked best solve times per difficulty
  • Profile — track completed games and best times across all difficulty levels
  • Settings — toggle sound effects and mistake highlighting

Tech Stack

  • Language: Kotlin
  • UI: Jetpack Compose
  • Auth & Database: Firebase Authentication + Firestore
  • Local Storage: SharedPreferences
  • Min SDK: 27 | Target SDK: 34

Architecture

app/src/main/java/
├── com/example/sudokuapp/
│   ├── data/           # Firebase, local storage, and data models
│   ├── screens/        # All Composable screens and navigation
│   └── ui/theme/       # Material3 theme
├── model/              # Core Sudoku logic (Board, Generator, Solver)
└── controller/         # Game controller

What I Learned & Challenges

  • Puzzle uniqueness — the biggest challenge was ensuring every generated puzzle has exactly one solution. Solved this by running a backtracking solver after each cell removal and only accepting the removal if the solution count stayed at exactly 1
  • Mixed language codebase — the core game logic is written in Java (model/) while the UI layer is in Kotlin with Jetpack Compose, I know Java from college classes, but have to spend time learning Kotlin and read docs to write the app.
  • State management — managing the game state (current board, puzzle board, timer, errors) across recompositions in Compose without losing data required thoughtful use of remember and LaunchedEffect
  • Guest vs authenticated users — designing a system that works seamlessly for both guests (local storage only) and logged-in users (local + Firestore sync) without duplicating logic
  • Navigation architecture — moving from passing arguments through nav routes to storing results in local storage simplified the navigation stack significantly and removed a class of bugs

Getting Started

  1. Clone the repo
    git clone https://github.com/huynna12/SudokuApp.git
  2. Open in Android Studio
  3. Add your own google-services.json from Firebase Console into app/
  4. Run on an emulator or physical device (API 27+)

About

An Android Sudoku game built with Kotlin, Java, Jetpack Compose and Firebase.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors