weaver

This is a function written in Go that draws a grid and fills random cells of that grid with characters. I'd like to use it as the basis for a game one day.

For now, you can use it to predict the future by reading signs of portent in the function's output.

func loom(columns, rows int) {

  var cell string
  var conc string

  delimiter := "|"

  cellNoise := 0
  cellFilled := 0
  cellEmpty := 0

  for rows > 0 {
    var row string = ""
    innerColumns := columns
    for innerColumns > 0 {
      seed := rand.NewSource(time.Now().UnixNano())
      random := rand.New(seed)
      randomNumber := random.Intn(100)
      if randomNumber%2 == 0 {
        cell = "@"
      } else if randomNumber == 37 {
                cell = "!"
        cellNoise = cellNoise + 1
      } else if randomNumber == 42 {
        cell = "&"
        cellFilled = cellFilled + 1 
      } else {
        cell = " "
        cellEmpty = cellEmpty + 1
      }
      conc = delimiter + cell
      row = row + conc
      innerColumns = innerColumns - 1
    }
    fmt.Println(row + delimiter)
    rows = rows - 1
  }
}

func main() {
  loom(5, 5)
}