Compare commits
7 Commits
101dedca7f
...
main
Author | SHA1 | Date | |
---|---|---|---|
d3ed2d922e | |||
e0b5a14a55 | |||
d28b0d6699 | |||
635b5440d7 | |||
63774c3267 | |||
f040ccfb01 | |||
5e7c8ee240 |
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.vscode
|
||||
armeisen/bin
|
||||
armeisen/obj
|
||||
.idea
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
||||
{
|
||||
"dotnet.defaultSolution": "armeisen.sln"
|
||||
}
|
133
armeisen/Armeise.cs
Normal file
133
armeisen/Armeise.cs
Normal file
@ -0,0 +1,133 @@
|
||||
public class Armeise
|
||||
{
|
||||
public int posY { get; set; }
|
||||
public int posX { get; set; }
|
||||
|
||||
public int age { get; set;}
|
||||
public int agedSinceLastMove { get; set; }
|
||||
|
||||
public ArmeiseType type { get; set; }
|
||||
public Directions directionFacing { get; set; }
|
||||
// Enum to have it obviousè what way turning
|
||||
public enum Directions
|
||||
{
|
||||
North,
|
||||
East,
|
||||
South,
|
||||
West
|
||||
}
|
||||
|
||||
public enum ArmeiseType
|
||||
{
|
||||
Queen,
|
||||
MaleWorker
|
||||
}
|
||||
|
||||
public Armeise(ArmeiseType _type = ArmeiseType.MaleWorker)
|
||||
{
|
||||
Random rand = new Random();
|
||||
posX = rand.Next(0, 100);
|
||||
posY = rand.Next(0, 100);
|
||||
directionFacing = Directions.North;
|
||||
type = _type;
|
||||
}
|
||||
|
||||
public void MoveRandom(int borderX, int borderY)
|
||||
{
|
||||
int minMove = 2;
|
||||
int maxMove = 6;
|
||||
int test = 3;
|
||||
}
|
||||
|
||||
public static void ShowStats(List<Armeise> meisen)
|
||||
{
|
||||
foreach (Armeise meise in meisen)
|
||||
{
|
||||
Console.Write("Position X: " + meise.posX);
|
||||
Console.Write(" Position Y: " + meise.posY);
|
||||
Console.Write(" Type: " + meise.type);
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
/**
|
||||
@returns
|
||||
Outputs all of the Armeisen that exist in a List of Armeisen, printing Position and type in the format of
|
||||
Position X: [Position X] Position Y: [Position Y] Type: [Type]. Method will crash the whole ass program if
|
||||
there is a Armeise without either Type, Position Y or Position X because i am and always will be too lazy
|
||||
to actually error handle this program, it is way too annoying and I dont have the motivation to do it, i
|
||||
mean like programming is fun and all but this is too much, i never want to do annoying work like this
|
||||
Anyways, yeah this is what the method does. I hope whoever reads this has a nice day.
|
||||
@Params amount: naja also wie soll ich sagen, ist halt relativ offensichtlich oder? Schau dir am besten
|
||||
nochmal die methode an haher. Dann siehst du das vielleicht. Doch nicht? dann kann ichs dir auch verraten
|
||||
Es ist ein Integer. Eine Zahl. Und naja der name davon ist halt amount. Zu deutsch ist es anzahl. 금액. määrä.
|
||||
summa. сумма. Wenn du es jetzt nicht verstanden ist kann ich auch nicht helfen.
|
||||
**/
|
||||
public static List<Armeise> PrintColonyStateForEachArmeiseInTheColonyExistingIfItHasPositionAndType(int amount = 100)
|
||||
{
|
||||
List<Armeise> colony = new List<Armeise>();
|
||||
for (int i = 0; i <= amount; i++)
|
||||
{
|
||||
colony.Add(new Armeise());
|
||||
}
|
||||
return colony;
|
||||
}
|
||||
|
||||
// public (Armeise, bool) Sex(List<Armeise> armeisen)
|
||||
// {
|
||||
// foreach (Armeise armeise in armeisen)
|
||||
// {
|
||||
// if ((armeise.posX - this.posX == 1 || armeise.posX - this.posX == -1) && (armeise.posY - this.posY == 1 || armeise.posY - this.posY == -1))
|
||||
// {
|
||||
// return new Armeise();
|
||||
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
public void MoveRandom()
|
||||
{
|
||||
Random rand = new Random();
|
||||
if (rand.Next(0, 5) == 0)
|
||||
{
|
||||
this.TurnLeft();
|
||||
}
|
||||
else if (rand.Next(0, 5) == 1)
|
||||
{
|
||||
this.TurnRight();
|
||||
}
|
||||
|
||||
this.Move(rand.Next(2, 7));
|
||||
}
|
||||
|
||||
public void Move(int steps)
|
||||
{
|
||||
switch (directionFacing)
|
||||
{
|
||||
case Directions.North:
|
||||
posY -= steps;
|
||||
break;
|
||||
case Directions.East:
|
||||
posX += steps;
|
||||
break;
|
||||
case Directions.South:
|
||||
posY += steps;
|
||||
break;
|
||||
case Directions.West:
|
||||
posX -= steps;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Moves the direction one up or down in the enum
|
||||
// Prevents ant from U-Turn and need modulo wrapping for north to west
|
||||
public void TurnRight()
|
||||
{
|
||||
directionFacing = (Directions)(((int)directionFacing + 1) % 4);
|
||||
}
|
||||
public void TurnLeft()
|
||||
{
|
||||
directionFacing = (Directions)(((int)directionFacing - 1 + 4) % 4);
|
||||
}
|
||||
}
|
27
armeisen/Map.cs
Normal file
27
armeisen/Map.cs
Normal file
@ -0,0 +1,27 @@
|
||||
public class Map
|
||||
{
|
||||
public int sizeY = 100;
|
||||
public int sizeX = 100;
|
||||
|
||||
// Draws map line by line, replacing the V wit A if ant there
|
||||
public void DrawMap(Armeise[] armeisen)
|
||||
{
|
||||
for (int i = 0; i <= sizeY; i++)
|
||||
{
|
||||
for (int j = 0; j <= sizeX; j++)
|
||||
{
|
||||
foreach (Armeise armeise in armeisen)
|
||||
{
|
||||
if (i == armeise.posY && j == armeise.posX)
|
||||
{
|
||||
Console.Write('A');
|
||||
break;
|
||||
}
|
||||
}
|
||||
Console.Write('.');
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
@ -1,2 +1,29 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace meise
|
||||
{
|
||||
public class Game
|
||||
{
|
||||
|
||||
static void Main()
|
||||
{
|
||||
Map mapInstance = new Map();
|
||||
Armeise armeise = new Armeise();
|
||||
|
||||
List<Armeise> colony = new List<Armeise>();
|
||||
colony = Armeise.PrintColonyStateForEachArmeiseInTheColonyExistingIfItHasPositionAndType();
|
||||
|
||||
while (true)
|
||||
{
|
||||
foreach (Armeise meise in colony)
|
||||
{
|
||||
meise.MoveRandom();
|
||||
}
|
||||
mapInstance.DrawMap(colony.ToArray());
|
||||
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v9.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v9.0": {
|
||||
"armeisen/1.0.0": {
|
||||
"runtime": {
|
||||
"armeisen.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"armeisen/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net9.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "9.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
Binary file not shown.
@ -1,22 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("armeisen")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("armeisen")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("armeisen")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
@ -1 +0,0 @@
|
||||
51e59712bef259c72b49cb0b8857cb2a433b277e97cec2a297c5379ed31f59a7
|
@ -1,15 +0,0 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net9.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = armeisen
|
||||
build_property.ProjectDir = c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||
build_property.EnableCodeStyleSeverity =
|
@ -1,8 +0,0 @@
|
||||
// <auto-generated/>
|
||||
global using global::System;
|
||||
global using global::System.Collections.Generic;
|
||||
global using global::System.IO;
|
||||
global using global::System.Linq;
|
||||
global using global::System.Net.Http;
|
||||
global using global::System.Threading;
|
||||
global using global::System.Threading.Tasks;
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
e8d25f5345b911b7175c8170d0e47038a51514c9c6adc406c328c1398ac11154
|
@ -1,14 +0,0 @@
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\bin\Debug\net9.0\armeisen.exe
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\bin\Debug\net9.0\armeisen.deps.json
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\bin\Debug\net9.0\armeisen.runtimeconfig.json
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\bin\Debug\net9.0\armeisen.dll
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\bin\Debug\net9.0\armeisen.pdb
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\armeisen.GeneratedMSBuildEditorConfig.editorconfig
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\armeisen.AssemblyInfoInputs.cache
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\armeisen.AssemblyInfo.cs
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\armeisen.csproj.CoreCompileInputs.cache
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\armeisen.dll
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\refint\armeisen.dll
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\armeisen.pdb
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\armeisen.genruntimeconfig.cache
|
||||
c:\Users\jerome.hebenstrick\dev\armeisen\armeisen\obj\Debug\net9.0\ref\armeisen.dll
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
45138e8429f76ae75b3c66239d7fa22ed1172cd6774cb6d65f420bc207d39827
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,69 +0,0 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"c:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\armeisen.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"c:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\armeisen.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "c:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\armeisen.csproj",
|
||||
"projectName": "armeisen",
|
||||
"projectPath": "c:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\armeisen.csproj",
|
||||
"packagesPath": "C:\\Users\\jerome.hebenstrick\\.nuget\\packages\\",
|
||||
"outputPath": "c:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\jerome.hebenstrick\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.301/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\jerome.hebenstrick\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\jerome.hebenstrick\.nuget\packages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
@ -1,74 +0,0 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net9.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net9.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\jerome.hebenstrick\\.nuget\\packages\\": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\armeisen.csproj",
|
||||
"projectName": "armeisen",
|
||||
"projectPath": "C:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\armeisen.csproj",
|
||||
"packagesPath": "C:\\Users\\jerome.hebenstrick\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\jerome.hebenstrick\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.301/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "vSkkojAXr1E=",
|
||||
"success": true,
|
||||
"projectFilePath": "c:\\Users\\jerome.hebenstrick\\dev\\armeisen\\armeisen\\armeisen.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": []
|
||||
}
|
Reference in New Issue
Block a user