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

16 lines
459 B
C#

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