using System;
using System.Linq;
public class Program
{
public static void Main()
Random rng = new Random();
int[] world = new int[] { 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0 };
for (int worldTick = 0; worldTick < 100; worldTick++) //This is our game loop
//Loop over the entire world
for (int i = 0; i < world.Length; i++)
//If we find a human (aka 1)
if (world[i] == 1)
int moveDirection = (int)(rng.Next(-1,2)); //move direction will be a random number between -1 and 1
world[i] = 0; //set the old poistion to air (aka 0)
world[i + moveDirection] = 1; //set the humans new position
}
//Print the entire world
//Ignore this code (point is that is prints out the entire world)
Console.WriteLine(string.Join(",",world.Select(x => x.ToString()))); //This comment shows the "raw" array
//Console.WriteLine(string.Concat(world.Select(x => x == 0 ? " " : x.ToString()))); ///This shows 0 (air) as a space