{"id":31588501,"url":"https://github.com/alecwaumans/othello-java-frontend-backend-client-server","last_synced_at":"2026-05-07T04:37:35.876Z","repository":{"id":317196346,"uuid":"1066368343","full_name":"AlecWaumans/Othello-Java-Frontend-Backend-Client-Server","owner":"AlecWaumans","description":"This project is a full client–server implementation of the classic Othello/Reversi game in Java 17 with JavaFX for the interface and SQLite for persistence. It features real-time board updates, undo/redo, surrender, and CPU opponents with basic or smart strategies, built on a modular Maven architecture.","archived":false,"fork":false,"pushed_at":"2025-09-29T12:41:50.000Z","size":828,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-29T14:28:54.531Z","etag":null,"topics":["backend","client-server","frontend","fxml","javafx","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlecWaumans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-29T11:45:28.000Z","updated_at":"2025-09-29T12:41:53.000Z","dependencies_parsed_at":"2025-09-29T14:39:25.909Z","dependency_job_id":null,"html_url":"https://github.com/AlecWaumans/Othello-Java-Frontend-Backend-Client-Server","commit_stats":null,"previous_names":["alecwaumans/othello-java-frontend-backend-client-server"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/AlecWaumans/Othello-Java-Frontend-Backend-Client-Server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlecWaumans%2FOthello-Java-Frontend-Backend-Client-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlecWaumans%2FOthello-Java-Frontend-Backend-Client-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlecWaumans%2FOthello-Java-Frontend-Backend-Client-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlecWaumans%2FOthello-Java-Frontend-Backend-Client-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlecWaumans","download_url":"https://codeload.github.com/AlecWaumans/Othello-Java-Frontend-Backend-Client-Server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlecWaumans%2FOthello-Java-Frontend-Backend-Client-Server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278547821,"owners_count":26004775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","client-server","frontend","fxml","javafx","sqlite"],"created_at":"2025-10-06T02:10:00.536Z","updated_at":"2025-10-06T02:11:18.255Z","avatar_url":"https://github.com/AlecWaumans.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Othello – Java Client/Server with Frontend \u0026 Backend\n\n![Java](https://img.shields.io/badge/Java-17-red?logo=openjdk)\n![JavaFX](https://img.shields.io/badge/JavaFX-FXML-blue?logo=java)\n![FXML](https://img.shields.io/badge/FXML-JavaFX-blue)\n![XML](https://img.shields.io/badge/XML-1.0-lightgrey)\n![SQLite](https://img.shields.io/badge/SQLite-3-lightgrey?logo=sqlite)\n![SQL](https://img.shields.io/badge/SQL-Relational-lightgrey)\n![Maven](https://img.shields.io/badge/Maven-Build-orange?logo=apachemaven)\n![License](https://img.shields.io/badge/License-MIT-green)\n\n## Overview\nA complete **client–server Othello (Reversi)** implementation in **Java 17**, with a **JavaFX** frontend (FXML) and **SQLite** persistence.  \nIt demonstrates real-time synchronization, a custom message protocol, **Undo/Redo/Surrender/Reset**, CPU opponents (Dumb / PseudoSmart), and a modular Maven multi-module setup.  \nThe project was developed as part of an academic assignment, highlighting **software design patterns** and **clean architecture**.\n\n---\n\n## Architecture (MVC-Inspired, Client–Server)\nThis repository is **Client–Server** with a **shared Common** module. It follows **MVC principles** but is **not a strict end-to-end MVC**:\n- **Server**: clear **Model + Controller** separation (no View). The server is the **single source of truth**: clients only send requests, and only the server modifies the game state.\n- **Client**: JavaFX **View (FXML)** + **Controllers**, with a lightweight client model (`OthelloClient`) for networking/state.\n- **Common**: DTOs/messages that define the contract between client and server. Both client and server depend on `Common`, but **not on each other**.\n\n**Modules**\n- **`OthelloCommonAlec` (Common)** — Protocol \u0026 DTOs:  \n  - `message.*`: `MessageInit`, `MessagePlay`, `MessageUndo`, `MessageRedo`, `MessageQuit`, `MessageReset`, `MessageGameInfo`, `MessageProfile`, `Type`.  \n  - `common.*`: `User`, `Members`, `GameInfo`, `PositionDTO`, `Config`.\n- **`OthelloServerAlec` (Backend)** — Game engine and persistence:  \n  - Model: `Board`, `Game`, `Position`, `State`, `GameState`.  \n  - Controller: `Controller`, `OthelloCompute`, `Strategy`, `DumbStrategy`, `PseudoSmartStrategy`.  \n  - Persistence: `DBManager`, `UserDAO`, `GameDAO`, `ScoreDAO`, `ResetDAO`, `StateMapper`.  \n  - Networking: `AbstractServer`, `Server`, `ConnectionToClient`.  \n  - Entry point: `ServerConsole`.\n- **`OthelloClientAlec` (Frontend)** — JavaFX-based application:  \n  - View: `LoginView.fxml`, `BoardPane`, `MainPane`, `ScorePane`, `ButtonPane`.  \n  - Controllers: `LoginController`, `ClientJavaFx`, `ClientConsole`.  \n  - Model: `OthelloClient` (extends `AbstractClient`).  \n  - Entry point: `MainApp`.\n\n---\n\n## Design Patterns\n- **Strategy** — AI behaviors (`DumbStrategy`, `PseudoSmartStrategy`).  \n- **Command** — Unified interface for actions (`execute`, `undo`, `redo`).  \n- **Memento-like Snapshots** — Undo/redo via history stacks in `Game`.  \n- **Observer** — JavaFX and client update views on state change.  \n- **DAO** — Encapsulation of database logic (`UserDAO`, `GameDAO`, etc.).  \n- **DTO / Mapper** — `GameInfo`, `Config`, `PositionDTO` exchanged over network; `StateMapper` ensures decoupling between server model and DTOs.\n\n---\n\n## Undo / Redo\n- **Server-side**: `Game` keeps two stacks: `undoHistory` and `redoHistory`.  \n- **Undo**: pops from `undoHistory`, restores board, pushes to `redoHistory`.  \n- **Redo**: pops from `redoHistory`, reapplies board, pushes to `undoHistory`.  \n- **Client-side**: JavaFX `ButtonPane` → buttons trigger `MessageUndo`/`MessageRedo` via controller.  \n- This guarantees deterministic state synchronization.\n\n---\n\n## Protocol (Messages)\nThe client–server communication is handled through a custom protocol:\n- `PROFILE` — identifies user on connection.  \n- `PLAY` — send a move.  \n- `UNDO` — request undo.  \n- `REDO` — request redo.  \n- `QUIT` — leave the game.  \n- `GAMEINFO` — full game state sync.  \n- `INIT` — start a new game.  \n- `RESET` — clear history.  \n\n---\n\n## Persistence (SQLite via JDBC)\nThe server uses an embedded **SQLite** database (`resources/sqliteDB/othello.db`) with schema in `othello.sql`:\n- Tables: `SEQUENCE`, `USER`, `GAME`, `SCORE`.  \n- `UserDAO.findOrCreate(email)` ensures every client is uniquely registered.  \n- Games and scores are persisted for history tracking.  \n\n---\n\n## Profile Management\n- Each player is represented by a `User` object (email + ID).  \n- On login, client sends `MessageProfile`; server responds with ACK.  \n- Limitations: no password, no avatars, only email/ID shown.  \n\n---\n\n## Debugging \u0026 Testing\n- **ClientConsole** and **ServerConsole** log all messages exchanged.  \n- This design makes debugging straightforward: every interaction can be traced.  \n\n---\n\n## Known Bugs \u0026 Limitations\n- No automatic **reconnection** after client crash/disconnect.  \n- Limited input validation (email format, port numbers).  \n- UI buttons remain active after `ENDGAME`.  \n- No integrated **scoreboard** in UI (data only in DB).  \n\n---\n\n## Future Improvements\n- Add **PASS** message for when a player has no legal moves.  \n- Implement **automatic reconnection** \u0026 better network error handling.  \n- Improve **UI feedback** (disable buttons at correct times, in-game scoreboard).  \n- Add **unit \u0026 integration tests** (currently only manual testing).  \n- Extend AI with **Minimax** or more advanced heuristics.  \n\n---\n\n## Screenshots\n![Login](doc/connection.jpeg)  \n*Login screen (JavaFX).*  \n\n![Configuration](doc/configuration.jpeg)  \n*Game setup (board size, mode).*\n\n![AI](doc/IA.jpeg)  \n*AI selection (Dumb / Smart).*  \n\n![Board](doc/gameInterface.jpeg)  \n*Board with Undo/Redo/Surrender.*  \n\n![GameOver](doc/GameOver.jpeg)  \n*GameOver Screen.*\n\n---\n\n## Setup\n\n### Requirements\n- JDK 17+  \n- Maven 3.8+  \n- SQLite driver (auto-included via `sqlite-jdbc`).  \n\n### Build\n```bash\ncd OthelloCommonAlec \u0026\u0026 mvn install -DskipTests\ncd ../OthelloServerAlec \u0026\u0026 mvn package -DskipTests\ncd ../OthelloClientAlec \u0026\u0026 mvn package -DskipTests\n```\n\n### Run Server\n```bash\ncd OthelloServerAlec\nmvn exec:java -Dexec.mainClass=\"main.ServerConsole\"\n```\n\n### Run Client\n```bash\ncd OthelloClientAlec\nmvn javafx:run -Dexec.mainClass=main.MainApp\n```\n\n---\n\n## Features\n- Real-time Othello gameplay with network sync.  \n- Undo / Redo, Surrender, Reset.  \n- CPU opponents with different strategies.  \n- SQLite persistence for users, games, scores.  \n- Modular, extensible architecture.  \n\n---\n\n## Author\n**Alec Waumans (2025)**\n\n---\n\n## License\nLicensed under the **MIT License** — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecwaumans%2Fothello-java-frontend-backend-client-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falecwaumans%2Fothello-java-frontend-backend-client-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falecwaumans%2Fothello-java-frontend-backend-client-server/lists"}