Currently when a move command is run, it requires a robot. This kinda sucks since to create a fake robot, we need to make up and pass a lot of information to it. Instead of using robots directly, we can use a string id instead, and just request the corresponding robot from the RobotManager. That way, when we test our functions that create commands, we only need to pass a string instead of a whole robot.
Implementation Steps:
In src/server/command/move-command.ts, all the move commands either take, or extend from a class that take a robot. Change this to instead use a string called robotId.
We will be requesting the robot from robot-manager by calling getRobot() and passing the robotId. Any instances where a this.robot.something() is called in .../move-command.ts, change it out by calling RobotManager.getRobot(this.robotId).something() (Make sure to import ../robot/robot-manager)
In src/server/command/command.ts, the RobotCommand class takes in a robot. Change that to also take in our new robotId string instead. Change the this.addRequirements() call in there to use this new robotId as well.
Finally, after importing robot manager, ctrl+f (search) all uses of execute() in .../command.ts and add robot manager as a parameter. Make sure to pass this parameter variable any time a something.execute() is called.
Expected Timeline:
This should be able to be completed in around one ChessBot meeting, or a few days
If you have any questions while working on this task, don't hesitate to do any one of the following:
There hasn't been much progress nor any updates on this. I'll go ahead and remove you since this has become a high priority. If it sits unfinished for a couple days, you can request to be added back on
Task Description:
Currently when a move command is run, it requires a robot. This kinda sucks since to create a fake robot, we need to make up and pass a lot of information to it. Instead of using robots directly, we can use a string id instead, and just request the corresponding robot from the RobotManager. That way, when we test our functions that create commands, we only need to pass a string instead of a whole robot.
Implementation Steps:
src/server/command/move-command.ts
, all the move commands either take, or extend from a class that take arobot
. Change this to instead use a string calledrobotId
..../move-command.ts
, change it out by calling RobotManager.getRobot(this.robotId).something() (Make sure to import../robot/robot-manager
)src/server/command/command.ts
, the RobotCommand class takes in a robot. Change that to also take in our new robotId string instead. Change the this.addRequirements() call in there to use this new robotId as well..../command.ts
and add robot manager as a parameter. Make sure to pass this parameter variable any time a something.execute() is called.Expected Timeline:
This should be able to be completed in around one ChessBot meeting, or a few days
If you have any questions while working on this task, don't hesitate to do any one of the following: