Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.