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