Trouble with Public Void Method in Loop C Sharp

Question:
Why is the “Turn” method in my project only running once in the loop? It should run once every loop but it only does once then doesn’t work anymore. Does anyone know why this may be?

Repl link:
https://replit.com/@EliotPotts/BlobAI?v=1

code snippet:

while (true)
            {
                List<Blobos> blobos = new List<Blobos>();
                for (int i = 0; i < 20; i++)
                {
                    blobos.Add(new Blobos());
                }
                
                Map.Reset();

                currentTurn++;
                foreach (Blobos b in blobos)
                {
                    b.Turn();
                }

                Map.RefreshMap();

                Console.WriteLine($"Turn: {currentTurn}");
                Console.WriteLine($"Eg Age: {blobos[0].age}");
                Thread.Sleep(1000);
            }

Actually i have now fixed it. I had put the blobo initiation in the loop when it needed to be outside the loop

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.