mirror of
https://github.com/farcasclaudiu/MartianRobots.git
synced 2026-06-29 01:01:20 +03:00
Add project files.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
namespace MartianRobotsSolver
|
||||
{
|
||||
public class RobotCommandForward: IRobotCommand
|
||||
{
|
||||
public string Command => "F";
|
||||
|
||||
public void Process(RobotInfo robotInfo)
|
||||
{
|
||||
int deltaX = 0;
|
||||
int deltaY = 0;
|
||||
switch (robotInfo.Head)
|
||||
{
|
||||
case "N":
|
||||
deltaY = 1;
|
||||
break;
|
||||
case "S":
|
||||
deltaY = -1;
|
||||
break;
|
||||
case "E":
|
||||
deltaX = 1;
|
||||
break;
|
||||
case "W":
|
||||
deltaX = -1;
|
||||
break;
|
||||
}
|
||||
robotInfo.PosX += deltaX;
|
||||
robotInfo.PosY += deltaY;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user