object Ulam extends App {
    generate(9)()
    generate(9)('*')

    private object Direction extends Enumeration { val RIGHT, UP, LEFT, DOWN = Value }

    private def generate(n: Int, i: Int = 1)(c: Char = 0) {
        assert(n > 1, "n > 1")
        val s = new Array[Array[String]](n).transform {_ => new Array[String](n) }

        import Direction._
        var dir = RIGHT
        var y = n / 2
        var x = if (n % 2 == 0) y - 1 else y