Created
January 18, 2016 11:03
-
-
Save ohkawa/ee5dc8634de1df8fabef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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