Skip to content

prathamb9/OODP_Mini_Project

Repository files navigation

⚖️ AlgoJudge — Competitive Programming Judge

A fully offline, Java-based competitive programming judge that simulates a real contest environment. Built as a college mini-project covering all 10 modules of the CS2016 (Object-Oriented & Design Patterns) syllabus.

Submit Java solutions → Auto-compile → Execute against hidden test cases → Live leaderboard


✨ Features

Feature Description
🔐 Auth System Register / Login with MD5-hashed passwords and role-based access (Admin / Contestant)
📝 Problem Viewer Browse 5 built-in problems with statements, sample I/O, difficulty badges, and scoring
💻 Code Editor In-app editor with syntax template, submit button, and real-time verdict display
Concurrent Judging 3-thread ExecutorService pool compiles and runs submissions in parallel via ProcessBuilder
🏆 Live Leaderboard Auto-updating rankings using PriorityQueue + Observer pattern
🛡️ Sandboxed Execution Time limits enforced per test case; infinite loops are killed automatically
🗄️ SQLite Database Persistent storage for users, problems, submissions, and leaderboard entries
📦 Serialization Binary .ser backup of every submission via ObjectOutputStream

🏗️ Architecture

src/
├── model/          # Data classes — User, Problem, Submission, TestCase, Verdict, LeaderboardEntry
├── interfaces/     # Evaluatable, Rankable, LeaderboardObserver
├── exception/      # CompilationException, TimeLimitExceededException, RuntimeErrorException, DatabaseException
├── collections/    # Leaderboard (PriorityQueue + HashMap), SubmissionCache (HashMap)
├── fileio/         # ProblemFileLoader, TestCaseLoader, SubmissionSerializer
├── db/             # DatabaseManager (Singleton), UserDAO, SubmissionDAO, ProblemDAO
├── engine/         # CompileRunner, TestCaseRunner, JudgeEngine, SubmissionQueue
├── judge/          # AbstractJudge, StandardJudge, StrictJudge, JudgeFactory
├── service/        # UserService, SubmissionService, ContestService
├── ui/             # MainApp, LoginScreen, RegisterScreen, ContestDashboard, ProblemScreen, LeaderboardScreen, AdminScreen
└── Main.java       # Entry point

📚 Syllabus Module Coverage

Module Topic Implementation
1 OOP Basics Encapsulation, static members, access modifiers across all model classes
2 Classes & Objects Constructor overloading, toString() / equals() / hashCode() overrides
3 Interfaces & Abstract Evaluatable, Rankable interfaces; AbstractJudge with Template Method pattern
4 Exception Handling 4 custom exceptions (checked + unchecked), try-with-resources throughout
5 Collections PriorityQueue, HashMap, ArrayList, LinkedBlockingQueue, Generics
6 File I/O BufferedReader (char streams), FileInputStream (byte streams), ObjectOutputStream (serialization)
7 Multithreading ExecutorService, ProcessBuilder, Future, Producer-Consumer with LinkedBlockingQueue
8 GUI (Swing) 7 screens with JTable, JSplitPane, JList, GridBagLayout, ActionListener
9 Design Patterns Singleton (DatabaseManager), Factory (JudgeFactory), Observer (LeaderboardObserver)
10 Integration End-to-end: GUI → Service → Engine → DB, with live leaderboard updates

🚀 Getting Started

Prerequisites

  • Java JDK 8 (java and javac must be accessible)
  • No frameworks or build tools needed — uses plain javac / java

Setup

git clone https://github.com/prathamb9/OODP_Mini_Project.git
cd OODP_Mini_Project

Compile

# Windows (CMD)
dir /s /b src\*.java > sources.txt
javac -cp "lib\sqlite-jdbc-3.45.1.0.jar;lib\slf4j-api-2.0.9.jar;lib\slf4j-simple-2.0.9.jar" -d out @sources.txt
del sources.txt

Run

java -cp "out;lib\sqlite-jdbc-3.45.1.0.jar;lib\slf4j-api-2.0.9.jar;lib\slf4j-simple-2.0.9.jar" Main

Default Login

Role Username Password
Admin admin admin123

📂 Problems Included

# Title Difficulty Max Score
P1 Hello World Easy 100
P2 Sum of Two Numbers Easy 100
P3 Fibonacci Number Easy 100
P4 Prime Check Medium 150
P5 Palindrome String Medium 150

🛠️ Tech Stack

Component Technology
Language Java 8
GUI Java Swing
Database SQLite (via JDBC)
Build Plain javac / java
Concurrency ExecutorService, ProcessBuilder

👥 Team Contributions

Member Part Scope
Member 1 Foundation Layer Models, Interfaces, Exceptions, Collections, File I/O, Database (Modules 1–6)
Member 2 Judge Engine CompileRunner, TestCaseRunner, JudgeEngine, AbstractJudge, Factory Pattern (Modules 3, 7, 9)
Member 3 GUI & Integration Swing screens, Service layer, Observer pattern, Main entry point (Modules 8–10)

📄 License

This project is licensed under the MIT License — see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors