/// Rohmer Maxime /// 28 April 2022 /// TileMap.cs using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WaveFunctionCollapseCLI { // The TileMap will contain all the WaveFunctionColllapse internal class TileMap { private Size _dimensions; private Tile[,] _tiles; public Size Dimensions { get => _dimensions; set => _dimensions = value; } internal Tile[,] Tiles { get => _tiles; set => _tiles = value; } public TileMap(Size dimensions,List avaibleTypes) { Dimensions = dimensions; Tiles = new Tile[Dimensions.Width, Dimensions.Height]; for (int x = 0; x < Dimensions.Width; x++) { for (int y = 0; y < Dimensions.Height; y++) { Tiles[x, y] = new Tile(avaibleTypes); } } } public void NextStep() { } public void Display(List types,List colors) { Console.Write("\n"); char sprite = '#'; for (int x = 0; x < Dimensions.Width; x++) { for (int y = 0; y < Dimensions.Height; y++) { //we check if there only is one possibility if (Tiles[x,y].PossibleTyles.Count < 2) { //Console.BackgroundColor = colors[types.IndexOf(new TileType(Tiles[x, y].PossibleTyles[0].Name))]; Console.ForegroundColor = colors[types.IndexOf(new TileType(Tiles[x, y].PossibleTyles[0].Name))]; } else { //this means that we need other steps to determinate wich Tile to use //Console.BackgroundColor = ConsoleColor.Gray; Console.ForegroundColor = ConsoleColor.Gray; } Console.Write(sprite); } Console.Write("\n"); } } } }