Skip to content

Instantly share code, notes, and snippets.

@chrisamaphone
Created October 11, 2018 12:37
Show Gist options
  • Save chrisamaphone/2f681614f21a6c6bf4d152434667f58c to your computer and use it in GitHub Desktop.
Save chrisamaphone/2f681614f21a6c6bf4d152434667f58c to your computer and use it in GitHub Desktop.
[Metric("Gold to Enemies Ratio")]
public static float GoldToEnemies(object map)
{
ChunkyLevel sl = (ChunkyLevel)map;
int gold = 0;
int enemies = 0;
for (int i = 0; i < sl.tiles.GetLength(0); i++)
{
for (int j = 0; j < sl.tiles.GetLength(1); i++)
{
if(sl.tiles[i,j] == -3)
{
gold++;
}
if(sl.tiles[i,j] == -4)
{
enemies++;
}
}
}
return (float)(enemies / gold);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment