Community puzzle 'Gravity' Go programming language

Thought I had a solution. Output matches what is expected but still fails.

`package main

import “fmt”
//import “os”

func main() {
var output [10][101] uint8
var width, height int

fmt.Scan(&width, &height)

for i:=0; i<height; i++ {
    for j:=0; j<width; j++ {
        output[i][j] = '.'
    }
}

for i := 0; i < height; i++ {
    var line string
    fmt.Scan(&line)
    for j:=0; j<width; j++   {
        if line[j]=='#'         {
            for k:=height-1; k>=0; k--   {
                if  output[k][j] != '#'     {
                    output[k][j]  = '#'
                    break
                }
            }
        }
    }
}

// fmt.Fprintln(os.Stderr, "Debug messages...")

for i := 0; i < height; i++  {
    fmt.Println(string(output[i][:]))
}

}`

We’re looking into it. Thank you for pointing that out.

sounds like this problem Suggestion: include unprintable characters in the error messages

1 Like

Your solution prints a lot of “\0” at the end of each line.
Like chrm said, we have an issue with unprintable characters (this will be fixed soon).

I was having the same issue in c#. I can solve the custom test case, but all the others say:
Found: Nothing
Expected: Nothing

I found that my problem was that I had an extra \n at the end of my string I was printing

1 Like