This commit is contained in:
Jerome Hebenstrick 2025-06-16 13:43:00 +02:00
parent f040ccfb01
commit 63774c3267
11 changed files with 8 additions and 11 deletions

View File

@ -11,11 +11,8 @@ namespace meise
Armeise armeise = new Armeise(); Armeise armeise = new Armeise();
mapInstance.DrawMap(armeise.posX, armeise.posY); mapInstance.DrawMap(armeise.posX, armeise.posY);
armeise.Move(2); armeise.TurnLeft();
mapInstance.DrawMap(armeise.posX, armeise.posY); armeise.TurnLeft();
armeise.TurnRight();
armeise.Move(2);
mapInstance.DrawMap(armeise.posX, armeise.posY);
} }
} }
@ -94,15 +91,15 @@ namespace meise
break; break;
} }
} }
// Using enums to make turning easier like this // Moves the direction one up or down in the enum
// Prevents ant from doing a U turn in one move // Prevents ant from U-Turn and need modulo wrapping for north to west
public void TurnRight() public void TurnRight()
{ {
directionFacing++; directionFacing = (Directions)(((int)directionFacing + 1) % 4);
} }
public void TurnLeft() public void TurnLeft()
{ {
directionFacing--; directionFacing = (Directions)(((int)directionFacing - 1 + 4) % 4);
} }
} }
} }

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("armeisen")] [assembly: System.Reflection.AssemblyCompanyAttribute("armeisen")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+101dedca7f0000a6490be72536deb2859167f446")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f040ccfb011cd610ba895e890787ab143e997406")]
[assembly: System.Reflection.AssemblyProductAttribute("armeisen")] [assembly: System.Reflection.AssemblyProductAttribute("armeisen")]
[assembly: System.Reflection.AssemblyTitleAttribute("armeisen")] [assembly: System.Reflection.AssemblyTitleAttribute("armeisen")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
aac56502c0079c943a87f6e8bae7d11cd21b0cc50bca17a7839d69eedffc7240 f2fbb7d92c00bf3847a0269c2d275c281e98d66b95774fa8a073bd5889a4b25c