Skip to content

Conversation

@Krish54491
Copy link
Contributor

I just added a boolean in some methods to differentiate between captured and uncaptured pieces, haven't seen any issue pop up because of it

@Kandles11 Kandles11 requested a review from Copilot September 30, 2025 00:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes robot behavior when returning home after capturing a piece by preventing them from spinning back to their starting heading. The fix introduces a noReverse parameter that disables the reversal of setup commands for captured pieces.

  • Added a noReverse boolean parameter to prevent robots from spinning back to starting positions
  • Fixed import statement and error handling by replacing error with proper Error constructor
  • Refactored AI move timing to wait for robot movements before sending move messages

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/server/robot/path-materializer.ts Added noReverse parameter and fixed import/error handling
src/server/command/move-piece.ts Modified command reversal logic based on noReverse flag
src/server/api/game-manager.ts Changed AI move timing to wait for robot completion

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 23 to 24
(command) =>
!noReverse ? command.reverse() : command,
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When noReverse is true, the setup commands are not reversed but still added to the command group. This means the robots will execute the same setup commands twice (once in setup, once in 'cleanup'), which could cause incorrect positioning.

Copilot uses AI. Check for mistakes.
import { GridIndices } from "./grid-indices";
import type { Robot } from "./robot";
import { error } from "console";
//import { error } from "console"; replaced with Error
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment has a grammatical error. It should be 'replaced with Error constructor' or simply 'replaced with Error'.

Suggested change
//import { error } from "console"; replaced with Error
//import { error } from "console"; replaced with Error constructor

Copilot uses AI. Check for mistakes.
}
if (!finalDestination) {
throw new error("WHERE THE HELL ARE YOU GOING");
throw new Error("WHERE THE HELL ARE YOU GOING"); // real
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message is unprofessional and unclear. Consider using a more descriptive message like 'Unable to determine final destination for robot movement'.

Suggested change
throw new Error("WHERE THE HELL ARE YOU GOING"); // real
throw new Error("Unable to determine final destination for robot movement");

Copilot uses AI. Check for mistakes.
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.

2 participants