Skip to content

Implement Ludo Game Logic#1

Draft
google-labs-jules[bot] wants to merge 6 commits intogofrom
ludo-game-logic-18180065291338951859
Draft

Implement Ludo Game Logic#1
google-labs-jules[bot] wants to merge 6 commits intogofrom
ludo-game-logic-18180065291338951859

Conversation

@google-labs-jules
Copy link

Implemented the core game logic for the Ludo game.

  • Modified Dice class to allow enabling/disabling clicks and to emit an event when rolling finishes.
  • Enhanced Piece class with click detection (hit testing) and methods to update visual position based on path index.
  • Created GameManager to orchestrate the game:
    • Manages player turns.
    • Handles dice roll results (6 to start, movement validation).
    • Implements piece movement along the path.
    • Implements capturing (collision detection) sending opponent pieces home.
    • Checks for win condition (all pieces at destination).
    • Handles re-roll on 6.
  • Updated main.ts to instantiate GameManager and properly initialize players with IDs.

PR created automatically by Jules for task 18180065291338951859 started by @Suloch

- Update `Dice` to support `enabled` state and emit `DICE_ROLL_FINISHED`.
- Update `Piece` to support click detection and position updates.
- Implement `GameManager` in `board.ts` to handle turns, moves, captures, and win conditions.
- Integrate `GameManager` in `main.ts` and assign player IDs.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

- Remove npm artifacts (`package-lock.json`).
- Ensure project builds with `bun run build`.
- (Code logic remains the same as previous commit: functionality for Dice, Piece, GameManager, and Main integration).
- Separate pure data interfaces into `model.ts`.
- Move rendering logic to `renderer.ts`.
- Convert `GameManager` in `board.ts` to pure logic.
- Update `main.ts` to wire Model, View, and Logic.
- Extract `DiceService` and `PieceFactory` interfaces in `services.ts`.
- Implement `RandomDiceService` and `StandardPieceFactory`.
- Update `GameManager` in `board.ts` to accept injected dependencies.
- Update `main.ts` to wire up the dependencies.
- Create `BoardMapper` to handle path generation and coordinate transforms.
- Remove hardcoded `red.ts` and `green.ts`.
- Update `Renderer` to use `BoardMapper` for drawing.
- Update `GameManager` to use `BoardMapper` for collision detection.
- Update `main.ts` to wire it all together.
- Created `game` package with `models.go` (Structs) and `manager.go` (Logic).
- Logic mirrors the frontend's rules (6 to start, collisions, turns).
- Updated `main.go` to be a thin NATS controller using the `game` package.
- Removed monolithic `server.go`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants

Comments