GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - MickaelDP/SeaWar-Terminal-Tactical-Battle: A Java-based naval tactical engine architectured with MVC principles featuring a multi-state heuristic AI and a custom TUI with a retro scientific calculator aesthetic.

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
Assets
Assets
 
 
Bateau.java
Bateau.java
 
 
Game.java
Game.java
 
 
LICENSE
LICENSE
 
 
Player.java
Player.java
 
 
Readme.md
Readme.md
 
 
SeaWar.java
SeaWar.java
 
 
launch_SeaWar
launch_SeaWar
 
 
makefile
makefile
 
 

Repository files navigation

SeaWar - Terminal Tactical Battle

A Java OOP implementation of the classic Naval Battle with a retro Scientific Calculator UI.

Paris 8 University - 2021 Original Development

2026 Refactored for Translation


Overview

SeaWar is a tactical battleship simulation developed in 2021. The project was designed with a strong focus on Object-Oriented Programming (OOP) and Heuristic Artificial Intelligence.

The unique visual style is inspired by retro scientific calculators and Minitel interfaces, using ANSI escape codes to render a full-screen GUI directly in the Unix terminal.

🛠 Object-Oriented Programming (OOP)

The project is architectured around four core classes to ensure a clear separation of concerns:

  • SeaWar.java: The main Controller. It manages the global application lifecycle, orchestrates the game loops, processes user inputs (via Regex), and handles the ANSI terminal rendering.
  • Player.java: Manages the player's state. It encapsulates the tactical logic, the two primary matrices (Deployment and Attack grids), and the fleet's data structures.
  • Bateau.java: The Ship Entity. It defines vessel properties, including size, health points (HP), and spatial coordinate tracking.
  • Game.java: The Session Manager. It handles global environment parameters, turn-based rotation logic, and session-specific states.

🤖 Heuristic AI (The "Hunt & Target" Algorithm)

The CPU doesn't just fire at random. It implements a multi-state decision engine:

  1. Search Mode : Uses a parity-based scanning pattern to find targets efficiently.
  2. Hunt Mode : Once a hit is confirmed, the AI uses a recursive Stack-based memory to explore adjacent cells.
  3. Destruction Mode : Tracks ship orientation and handles "composite targets" (overlapping ships) by prioritizing wounded vessels.

Valid coordinate for the 5-cell ship
5-cell ship
Valid coordinate after hit
after hit
Valid coordinate after align
after align
Sunken
Sunken

🎨 Retro-UI Engine

  • ANSI Rendering : Real-time color updates for Fog of War, Hits, and Sinks.
  • Dynamic ASCII Art : Automated rendering of different ship classes based on their health status.
  • Terminal Control : Integrated shell script for automatic terminal resizing (100x41).

Seawar UI
Seawar UI

📋 Technical Stack

  • Architecture : Model-View-Controller (MVC) pattern.
  • Standard Libs : java.util.Scanner, java.util.Stack, java.util.HashMap, java.util.regex.Pattern.

🛠 Installation & Execution Guide

This project is designed to run in a Unix-like terminal (Linux/macOS) to ensure the proper rendering of ANSI colors and terminal resizing.

  • Quick Start (via Shell Script)
    The project includes a launch script that automatically handles the terminal dimensions (100x41) required for the Scientific Calculator UI.

Grant execution permissions (if needed):

    chmod +x launch_SeaWar

Run the game:

    ./launch_SeaWar
  • Manual Build (from Source) If you wish to recompile the project from the src directory:

Compile using the Makefile:

    make

Execute manually (Ensure your terminal is large enough):

    # Set terminal size manually to 100x41 and run
    printf '\e[8;41;100t'
    java SeaWar

🖥 Terminal Compatibility

ANSI Colors: This game uses ANSI escape codes. For the best experience in an IDE like Eclipse, the ANSI Escape in Console plugin is recommended.

About

A Java-based naval tactical engine architectured with MVC principles featuring a multi-state heuristic AI and a custom TUI with a retro scientific calculator aesthetic.

Topics

ai-logicgame-engineheuristic-algorithmjavalegacy-codemvc-architectureretrogamingterminal-ui

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.