public static void testTranRobot(TranRobot obj) { Console.WriteLine("robot is intially at "); printTransRobotCoord(obj); obj.Forward(); Console.Write("robot used forward()"); printTransRobotCoord(obj); obj.Forward(); Console.Write("robot used forward()"); printTransRobotCoord(obj); obj.Left(); Console.Write("robot used left()"); printTransRobotCoord(obj); obj.Right(); Console.Write("robot used Right()"); printTransRobotCoord(obj); obj.Back(); Console.Write("robot used Back()"); printTransRobotCoord(obj); }
public static robot[] generateRobot() { int batterylife = 1; robot[] arr = new robot[SIZE]; for (int i = 0; i < 3; i++) { arr[i] = new robot(directory, batterylife); } for (int i = 3; i < 6; i++) { arr[i] = new RotatingRobot(directory, batterylife); } for (int i = 6; i < 9; i++) { arr[i] = new TranRobot(directory, batterylife); } return(arr); }
public static void printTransRobotCoord(TranRobot obj) { Console.WriteLine("row:{0} Column:{1}", obj.getRow(), obj.getColumn()); }