Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 22, 2019 03:50
Show Gist options
  • Save IntegerMan/20b2bb78ebf0507c510a01985f804391 to your computer and use it in GitHub Desktop.
Save IntegerMan/20b2bb78ebf0507c510a01985f804391 to your computer and use it in GitHub Desktop.
let displayWorld (world: World) turnsRemaining =
printfn ""
printfn "%i turn(s) remaining" turnsRemaining
printfn ""
for y in 1..world.MaxX do
printf " " // Indent slightly so it is a bit more readable
for x in 1..world.MaxY do
// Determine which character should exist in this line
let char = world |> getCharacterAtCell(x,y)
// Let's set the overall color
match char with
| '.' -> Console.ForegroundColor <- ConsoleColor.DarkGreen
| 't' -> Console.ForegroundColor <- ConsoleColor.Green
| 'a' -> Console.ForegroundColor <- ConsoleColor.DarkYellow
| 'S' | 's' -> Console.ForegroundColor <- ConsoleColor.Yellow
| 'D' -> Console.ForegroundColor <- ConsoleColor.Red
| 'R' -> Console.ForegroundColor <- ConsoleColor.Magenta
| _ -> Console.ForegroundColor <- ConsoleColor.Gray
printCell char (x = world.MaxX)
// Ensure we go back to standard format
Console.ForegroundColor <- ConsoleColor.White
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment