string MapToString() { string returnString = string.Join(" ", // Seperator between each element "Width:", MapWidth.ToString(), "\tHeight:", MapHeight.ToString(), "\t% Walls:", PercentAreWalls.ToString(), Environment.NewLine ); List <string> mapSymbols = new List <string>(); mapSymbols.Add("."); mapSymbols.Add("#"); mapSymbols.Add("+"); for (int column = 0, row = 0; row < MapHeight; row++) { for (column = 0; column < MapWidth; column++) { returnString += mapSymbols[Map[column, row]]; } returnString += Environment.NewLine; } return(returnString); }
string MapToString() { string returnString = string.Format("{0} {1} {2} {3} {4} {5} {6}", // Seperator between each element "Width:", MapWidth.ToString(), "\tHeight:", MapHeight.ToString(), "\t% Walls:", PercentAreWalls.ToString(), "\n"); List <string> mapSymbols = new List <string>(); mapSymbols.Add("-"); mapSymbols.Add("#"); mapSymbols.Add("+"); for (int column = 0, row = 0; row < MapHeight; ++row) { for (column = 0; column < MapWidth; ++column) { returnString += mapSymbols[Map[column, row]]; } returnString += "\n"; } return(returnString); }
string MapToString() { string returnString = " " + "Width:" + MapWidth.ToString() + "\tHeight:" + MapHeight.ToString() + "\t% Walls:" + PercentAreWalls.ToString() + "\n"; List <string> mapSymbols = new List <string>(); mapSymbols.Add("."); mapSymbols.Add("#"); mapSymbols.Add("+"); for (int column = 0, row = 0; row < MapHeight; row++) { for (column = 0; column < MapWidth; column++) { returnString += mapSymbols[Map[column, row]]; } returnString += "\n"; } return(returnString); }
public override string ToString() { return(string.Join(" ", "Width:", MapWidth.ToString(), "\tHeight:", MapHeight.ToString(), "\tSeed:", Seed.ToString(), Environment.NewLine )); }
public virtual string getDescription() { string returnString = string.Join(" ", "Width:", MapWidth.ToString(), "\tHeight:", MapHeight.ToString(), "\tSeed:", Seed.ToString(), Environment.NewLine ); return(returnString); }
private void OK_Click(object sender, RoutedEventArgs e) { try { XPos = Convert.ToInt32(_XPos.Text); } catch (FormatException) { MessageBox.Show("Value Position X ='" + _XPos.Text + "'is not in a recognizable format.", "Error"); return; } try { YPos = Convert.ToInt32(_YPos.Text); } catch (FormatException) { MessageBox.Show("Value Position Y ='" + _YPos.Text + "'is not in a recognizable format.", "Error"); return; } if (XPos < 0 || XPos >= MapWidth) { MessageBox.Show("A value Start position X must: 0<= x < " + MapWidth.ToString()); return; } if (YPos < 0 || YPos >= MapWidth) { MessageBox.Show("A value Start position Y must: 0<= y < " + MapHeight.ToString()); return; } try { LEVEL = Convert.ToInt32(Level.Text); } catch (FormatException) { MessageBox.Show("Value level: " + Level.Text + "is not in a recognizable format.", "Error"); return; } try { TIMES = Convert.ToInt32(Times.Text); } catch (FormatException) { MessageBox.Show("Value level: " + Times.Text + "is not in a recognizable format.", "Error"); return; } TIMES = Convert.ToInt32(Times.Text); MapName = _MapName.Text; IsOK = true; this.Close(); }
public override string ToString() { string returnString = string.Join(" ", "Width:", MapWidth.ToString(), "\tHeight:", MapHeight.ToString(), "\t% Walls:", PercentAreWalls.ToString(), "\tSeed:", Seed.ToString(), Environment.NewLine ); return(returnString); }
public override string getDescription() { string returnString = string.Join(" ", "Width:", MapWidth.ToString(), "\tHeight:", MapHeight.ToString(), "\t% Walls:", PercentAreWalls.ToString(), "\tSeed:", Seed.ToString(), "\tClusters:", GetNumClusters(), Environment.NewLine ); return(returnString); }