How eliaws/el_mon_tribala works
1. What this repository is
el_mon_tribala is a standalone Java card game inspired by Balatro. It is an offline, single-player run-based game where the player must clear successive blinds by reaching score targets with poker hands.
2. Top-level architecture
The code is organized around a clear MVC split, but with game rules extracted into a separate domain/ layer. In practice: the controller coordinates the run, the model stores mutable game progression, the domain encapsulates all poker/economy rules, and the view layer renders the state in either console or “zen” mode.
3. Entry point and launch modes
src/Main.java is the application entry point. The README shows two runtime modes selected by command-line argument: console and zen. That means presentation is swapped at startup, while the underlying game logic stays the same.
4. Control flow through the game loop
controller/GameController.java is the main orchestrator. It receives player actions from a view, applies them to the game state, and produces a PlayResult that likely summarizes the outcome of a move or hand. This keeps the UI from directly mutating game rules.
5. Mutable game state vs. rule objects
model/GameState.java and model/GamePhase.java hold the evolving run state and the current phase of play. This layer is the bridge between UI and rules: it tracks where the player is in the run, what phase they are in, and what the controller should allow next.
6. Core domain entities
The domain/ package contains the game’s fundamental concepts: Card, Rank, Suit, Deck, Blind, and Shop. These are the data and rule objects that define the game without any rendering concerns. Blind represents the score challenge to beat, and Shop represents the between-blind economy.
7. Progression and economy
domain/consummables/Planet.java is the main upgrade item. The README says planets improve poker combinations, so the shop is not cosmetic: it is a gameplay subsystem that modifies scoring/progression between blinds. The run is structured around 8 antes, so progression is a sequence of increasingly demanding score thresholds.
8. Hand representation and evaluation
Poker logic is split into multiple layers under domain/hand/. HandType classifies a hand, hand/combinations/* contains concrete poker-hand implementations such as Pair, TwoPair, Straight, Flush, FullHouse, and RoyalFlush, and PlayedHand likely binds an actual set of cards to one of those recognized combinations.
9. Scoring pipeline
domain/hand/evaluation/HandEvaluator.java determines what kind of hand was played, and domain/hand/scoring/HandScorer.java converts that evaluation into a numeric Score. This separation matters: recognition of the hand is distinct from calculating its value, which makes balancing easier and keeps the scoring logic isolated.
10. Presentation layer
view/View.java is the abstraction, with ConsoleView.java and ZenView.java as concrete presenters. Rect.java suggests the zen interface uses positioned rectangular UI elements. The view layer reads state/results and displays them; it should not contain game rules.
11. Assets and theming
src/ressources/ contains fonts and image sets grouped by themes such as death, life, planets, space, and time. These assets are part of the presentation layer and reinforce that the game uses themed visuals rather than external services or dynamic content.
12. Important architectural boundary
The strongest boundary in this repository is between presentation/game flow and pure game rules. That makes the scoring, hand evaluation, and progression systems reusable across both console and zen views, and it keeps the architecture suitable for diagramming as: input/view → controller → state/domain → view update, with assets only touching the final rendering step.
Main entry points: GameController.java Game controller · View.java View · Main.java Main · GameState.java Game state
Components 21
Application
Entry point and runtime selection
- Main · Starts the game and selects runtime mode
src/Main.java
Game Flow
Orchestration and mutable run state
- Game controller · Coordinates player actions, game state, and play outcomes
src/controller/GameController.java - Play result · Summarizes the outcome of a move or hand
src/controller/PlayResult.java - Game state · Holds mutable run progression and current context
src/model/GameState.java - Game phase · Tracks the current phase of play
src/model/GamePhase.java
Domain Rules
Cards, hands, scoring, shop, and blinds
- Card · Represents a playing card
src/domain/Card.java - Rank · Card rank values
src/domain/Rank.java - Suit · Card suit values
src/domain/Suit.java - Deck · Card deck and draw flow
src/domain/Deck.java - Blind · Score target that must be cleared
src/domain/Blind.java - Shop · Between-blind upgrade and purchase flow
src/domain/Shop.java - Planet · Upgrade item that improves poker combinations
src/domain/consummables/Planet.java - Hand evaluator · Recognizes the poker combination played
src/domain/hand/evaluation/HandEvaluator.java - Hand scorer · Converts evaluated hands into points
src/domain/hand/scoring/HandScorer.java - Score · Numeric scoring result
src/domain/hand/scoring/Score.java - Played hand · Bound set of cards and its recognized combination
src/domain/hand/combinations/PlayedHand.java - Hand type · Hand category used by evaluation and scoring
src/domain/hand/HandType.java
Presentation
Views and themed assets
- View · Abstract view interface for rendering and input
src/view/View.java - Console view · Text-based presentation mode
src/view/ConsoleView.java - Zen view · Graphical presentation mode
src/view/ZenView.java - Rect · Positioned rectangle used by the zen interface
src/view/Rect.java
Connections 23
- Main → Game controller: starts game · Launches the run loop and runtime mode
- Main → Console view: console mode · Selects text presentation at startup
- Main → Zen view: zen mode · Selects visual presentation at startup
- Game controller → Game state: reads/writes · Updates mutable run state
- Game controller → Play result: produces · Returns move or hand outcome
- Game controller → View: drives · Sends state and outcomes to presentation
- View → Console view: implemented by · Console rendering path
- View → Zen view: implemented by · Zen rendering path
- Zen view → Rect: lays out · Uses rectangles for interface geometry
- Game state → Game phase: tracks · Stores current phase of play
- Deck → Card: contains · Draws and manages cards
- Card → Rank: has · Card rank value
- Card → Suit: has · Card suit value
- Game controller → Blind: advances · Moves through score targets
- Game controller → Shop: enters · Routes between blinds to economy flow
- Shop → Planet: offers · Provides upgrade consumables
- Hand evaluator → Played hand: builds · Classifies a set of cards as a played hand
- Hand evaluator → Hand type: recognizes · Maps cards to a hand category
- Hand scorer → Hand evaluator: consumes · Scores the evaluated combination
- Hand scorer → Score: returns · Produces numeric score
- Played hand → Hand type: classified as · Stores the detected hand category
- Game state → Hand scorer: uses · Run progression depends on scored hands
- View → Play result: renders · Displays outcome feedback