{"id":46026663,"url":"https://github.com/fatmakahveci/memorygame","last_synced_at":"2026-03-01T03:05:45.894Z","repository":{"id":61979886,"uuid":"537208132","full_name":"fatmakahveci/MemoryGame","owner":"fatmakahveci","description":"A simple card game to to practice Java and JUnit.","archived":false,"fork":false,"pushed_at":"2026-03-01T01:25:09.000Z","size":88,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-01T02:34:59.266Z","etag":null,"topics":["clean-architecture","cli-application","code","coding","core-java","game","java","junit","maven","oop","practice","practice-programming","practice-programming-skills","programming","programming-exercises","programming-language","programming-languages","testing","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fatmakahveci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2022-09-15T21:13:01.000Z","updated_at":"2026-03-01T01:24:48.000Z","dependencies_parsed_at":"2022-10-24T16:00:22.876Z","dependency_job_id":null,"html_url":"https://github.com/fatmakahveci/MemoryGame","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fatmakahveci/MemoryGame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatmakahveci%2FMemoryGame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatmakahveci%2FMemoryGame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatmakahveci%2FMemoryGame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatmakahveci%2FMemoryGame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fatmakahveci","download_url":"https://codeload.github.com/fatmakahveci/MemoryGame/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatmakahveci%2FMemoryGame/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29959284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"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":["clean-architecture","cli-application","code","coding","core-java","game","java","junit","maven","oop","practice","practice-programming","practice-programming-skills","programming","programming-exercises","programming-language","programming-languages","testing","unit-testing"],"created_at":"2026-03-01T03:05:45.092Z","updated_at":"2026-03-01T03:05:45.882Z","avatar_url":"https://github.com/fatmakahveci.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI](https://github.com/fatmakahveci/MemoryGame/actions/workflows/ci.yml/badge.svg)\n\n# Memory Game\n\nTerminal memory card game in Java designed around testable architecture, dependency injection and clean separation between game engine and UI.\n\nThis project is not just a game — it is a small exercise in writing **testable and modular software**.\nThe goal was to separate game rules, input/output, and board logic so the core behaviour can be tested independently from the console.\n\n---\n\n## Demo\n\n![demo](demo.gif)\n\n---\n\n## Why this project exists\n\nMany beginner Java projects tightly couple game logic with user input, which makes testing difficult.\n\nIn this project:\n\n- the game rules are independent from the console\n- input is abstracted behind an interface\n- the board logic is unit tested\n- user interaction can be mocked in tests\n\nThis allows the program to be tested without manual interaction.\n\n---\n\n## Features\n\n- turn-based memory card matching game\n- configurable board size\n- clean separation between UI and game logic\n- deterministic unit tests using mocked input\n- error handling for invalid positions\n\n---\n\n## Architecture\n\nThe project separates responsibilities into distinct layers:\n\n- **GameEngine** → game rules, scoring, turn handling\n- **Board** → board state and matching logic\n- **ConsoleUI** → user interaction and rendering\n- **Input abstraction** → allows mocking user interaction in tests\n\nThis design allows the core game logic to be tested without any console input.\n\n---\n\n## Project structure\n\n```\nmemorygame\n├── Board.java        -\u003e board state \u0026 matching logic\n├── Cell.java         -\u003e individual card representation\n├── Position.java     -\u003e immutable board position\n├── MemoryGame.java   -\u003e game flow / rules\n├── Input.java        -\u003e input abstraction\n└── ScannerInput.java -\u003e console implementation\n```\n\nThe `Input` interface allows the game to run without a real user during tests.\n\n---\n\n## Requirements\n\n- Java 21+\n- Maven\n\n---\n\n## Run locally\n\nClone the repository:\n\n```bash\ngit clone https://github.com/fatmakahveci/MemoryGame.git\ncd MemoryGame\n```\n\nBuild:\n\n```bash\nmvn package\n```\n\nRun:\n\n```bash\njava -jar target/memorygame-1.0-SNAPSHOT.jar\n```\n\n---\n\n## Running tests\n\n```bash\nmvn test\n```\n\nThe tests use mocked input to simulate player actions and verify game behaviour.\n\n---\n\n## Design notes\n\nThe main design decision was introducing an `Input` interface.\n\nInstead of reading directly from `Scanner` inside the game logic, user interaction is injected into the game.\nThis makes it possible to test the game automatically and verify edge cases such as invalid input or repeated moves.\n\nThis pattern is similar to dependency injection and is commonly used in backend services to isolate side effects.\n\n---\n\n## Possible improvements\n\n- scoring system\n- multiple players\n- GUI (Swing/JavaFX)\n- persistent high scores\n\n---\n\n## License\n\nApache License 2.0\n\n---\n\n✅ Coverage report is generated with JaCoCo and uploaded as a GitHub Actions artifact on every push.\n\n---\n\n## What I learned\n\nThis project focuses on writing testable code rather than just making the game work.\n\nKey takeaways:\n- separating business logic from UI\n- designing for unit testing\n- deterministic tests with controlled input\n- small but maintainable architecture\n\n---\n\nContributions, suggestions and improvements are welcome.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatmakahveci%2Fmemorygame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffatmakahveci%2Fmemorygame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatmakahveci%2Fmemorygame/lists"}