Skip to content

[Server]: Change Robots/Pieces to Have Piece-Type Attribute #265

@MahdMalik

Description

@MahdMalik

Task Description:

Currently, the pieces and robots on the server side don't really know what pieces they are. So, when we need to get what piece is at a certain square (say to see where they can move and if its legal), we have to do some extra things, when we could just fetch the attribute for that piece instead. So, the idea is to give it the piece type attribute, and then refactor the code to use the piece type instead of other things.

So directionToEdge does not refer to the edge of the board; it refers to going to the edge of a square (obviously!).

Implementation Details:

  • First, actually figure out what I need to do. Two aspects:

    • Where are we actually creating the piece objects on the server? Is it just the robot class, or something else?
    • Where is an example of extra code that we can remove if we had the piece type? Will let me know what parts of the code overall can be simplified.
  • Then, change it to add the attribute to it. Need to make sure to assign them correctly.

  • Then, simplify all the functions to use the piece type attribute from the piece, rather than using other ways to get the piece there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    D2Medium DifficultyP1Low PriorityS26Current relevant issue that should be worked on in the spring 2026 semesterapprovedThis issue has passed the draft stage, and is ready to be assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions