fork download
  1. object Main extends App {
  2. case class Field(sizeX: Int, sizeY: Int, points: Set[(Int, Int)]) {
  3. def mkString: String = {
  4. val data = for (x <- 0 until sizeX) yield
  5. for (y <- 0 until sizeY) yield
  6. if (points.contains(x -> y)) '\u25A0' else '\u25A1'
  7. data.map(_.mkString).mkString("\n")
  8. }
  9. }
  10.  
  11. println(Field(10, 10, Set(0 -> 1, 4 -> 5)).mkString)
  12. }
Success #stdin #stdout 0.39s 322496KB
stdin
Standard input is empty
stdout
□■□□□□□□□□
□□□□□□□□□□
□□□□□□□□□□
□□□□□□□□□□
□□□□□■□□□□
□□□□□□□□□□
□□□□□□□□□□
□□□□□□□□□□
□□□□□□□□□□
□□□□□□□□□□