mirror of
https://github.com/farcasclaudiu/MartianRobots.git
synced 2026-06-22 11:01:26 +03:00
16 lines
458 B
C#
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();
|
|
}
|
|
}
|
|
}
|