POOSnake — Snake Remix

Java

A modern remake of the classic Snake game with both Swing-based GUI and console interfaces, manual and AI-pathfinding modes, customizable arena, dynamic rotating obstacles, a leaderboard, and JUnit-tested core mechanics.

A remake of Snake built for the Object-Oriented Programming course, with a deliberate emphasis on clean OOP structure: separate Core/, Geometry/, and UI/ packages, JUnit tests for both the core game logic and the geometry primitives.

What it does

Two interfaces, same engine

InterfaceTechUse case
GraphicalJava Swing GUIModern visual rendering
TextualConsoleTerminal enthusiasts

Both share the exact same core engine — the UI is a thin presentation layer over Arena, Snake, AbstractFood, and Obstacle.

Two play modes

Customization

OptionEffect
Arena dimensionsCustom width and height
Snake head sizeDifficulty knob
Food typeCircle or square
RasterizationFilled or outlined
ObstaclesStatic or dynamic (rotating around a custom pivot point)
ScoringConfigurable points per food item

Dynamic obstacles rotate around custom pivots — the collision system has to handle moving geometry, which made the AABB / point-in-polygon checks in Geometry/ worth thinking about properly.

Leaderboard

Player scores persist to rank.txt and are displayed at the end of each session, so high scores survive restarts.

Test coverage

The project ships with JUnit 5 tests for both the core (POOSnake/Core/CoreTests/) and the geometry primitives (POOSnake/Geometry/GeometryTests/) — runnable via the bundled junit-platform-console-standalone jar.

Why it matters

This was the project where I really internalized separation of concerns and the factory / strategy / abstract-base-class patterns: the core engine doesn’t know whether it’s being rendered to a JFrame or to stdout, food types are swappable through a common abstract base, and the AI mode plugs into the same Snake movement interface as a human player. Built in collaboration with José Lima and Pedro Ferreira.