-
Notifications
You must be signed in to change notification settings - Fork 4
Description
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.