Files
2022-09-13 02:43:55 +03:00

16 lines
458 B
C#

namespace MartianRobotsSolver
{
public class RobotCommandLeft : IRobotCommand
{
public string Command => "L";
public void Process(RobotInfo robotInfo)
{
var hIndex = RobotCommandConstants.HEADING.IndexOf(robotInfo.Head)-1;
if(hIndex<0)
hIndex = RobotCommandConstants.HEADING.Length-1;
robotInfo.Head = RobotCommandConstants.HEADING[hIndex].ToString();
}
}
}