Skip to content

Instantly share code, notes, and snippets.

@ohkawa
Created January 18, 2016 11:03
Show Gist options
  • Select an option

  • Save ohkawa/ee5dc8634de1df8fabef to your computer and use it in GitHub Desktop.

Select an option

Save ohkawa/ee5dc8634de1df8fabef to your computer and use it in GitHub Desktop.
// gomoku_2016_01_18.txt
// https://gist.github.com/bsoo/bd361a7fe01fc6bff068
package main
import "strings"
func lesson01(num int) {
asterisk := 1
blank := num / 2
for i := 0; i < num; i++ {
print(strings.Repeat(" ", blank))
print(strings.Repeat("*", asterisk))
print(strings.Repeat(" ", blank))
println()
if i < num/2 {
asterisk += 2
blank -= 1
} else {
asterisk -= 2
blank += 1
}
}
}
func main() {
lesson01(7)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment