using System;
namespace AmeisenSimulation
{
class MainProgram
{
public static void BringAntIntoDanger(objects[] Givenants)
{
Random rnd;
Antdanger[] DangerObjects= new Dangerobject[15];
for (int i = 0; i <DangerObjekte.Length; i++)
{
Dangerobject animal= new Antdanger();
for (int k = 0; k < DangerObjects.Length; i++)
{
DangerObjects[k].Aktualisieren();
if ((objects)DangerObjects[k] == Givenants[rnd.Next(0, Givenants.Length)])
{
tmpAnt= GivenAnts[rnd.Next(0, Givenants.Length)];
Console.WriteLine("Hit,AntsFalls");
tmpAnt.Delete();
}
}
}
}
static void Main(string[] args)
{
Console.WriteLine("LOL");
System.Console.SetCursorPosition(10, 0);
System.Console.Write("AntSim_008_Vererbung_und_Polymorphie");
int days= 20;
int ants= 10;
int queens= 1;
object[] Dangerarray= new object[5];
System.Console.CursorVisible = false;
object[] myAnt= new object[ants+ queens];
for (int a = 0; a < ants; a++)
myants[a] = new Ant();
myants[ants] = new Queen();
for (int t = 0; t < days; t++)
{
for (int a = 0; a < (ants + queens); a++)
{
myAnts[a].update();
bringAntintoDanger(meineAmeise);
}
System.Threading.Thread.Sleep(200);
}
System.Console.SetCursorPosition(10, 24);
System.Console.ReadKey();
}
}
class GeneralObject
{
public int posX;
public int posY;
public char symbol;
public GeneralObject()
{
posX = 40;
posY = 12;
symbol = 'A';
}
public void delete()
{
System.Console.SetCursorPosition(posX, posY);
System.Console.Write(" ");
}
public void Draw()
{
System.Console.SetCursorPosition(posX, posY);
System.Console.Write(symbol);
}
public virtual void Update()
{
Loeschen();
Malen();
}
}
class classAnt: Generalobject
{
protected int HPLive?;
protected System.Random rnd;
public ClassAnt()
: base()
{
System.Threading.Thread.Sleep(20);
rnd = new System.Random();
}
public override void update()
{
Loeschen();
Bewegen();
Malen();
}
public void Move()
{
Loeschen();
posX = posX + rnd.Next(-1, 2);
posY = posY + rnd.Next(-1, 2);
if (posX < 0)
posX = 0;
if (posX > 79)
posX = 79;
if (posY < 0)
posY = 0;
if (posY > 24)
posY = 24;
Malen();
}
}
}