Skip to content

Instantly share code, notes, and snippets.

@qi7chen
Created August 26, 2015 07:51
Show Gist options
  • Select an option

  • Save qi7chen/501e4029a306b1516028 to your computer and use it in GitHub Desktop.

Select an option

Save qi7chen/501e4029a306b1516028 to your computer and use it in GitHub Desktop.

Revisions

  1. qi7chen created this gist Aug 26, 2015.
    49 changes: 49 additions & 0 deletions bigdigit.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    package main

    import (
    "fmt"
    "os"
    "path/filepath"
    )

    var print = fmt.Println


    func main() {
    progname := filepath.Base(os.Args[0])
    if len(os.Args) < 2 {
    print("Usage: %s <whole-number", progname)
    os.Exit(1)
    }
    number := os.Args[1]
    for row := 0; row < len(bigDigits[0]); row++ {
    line := ""
    for _, ch := range number {
    digit := ch - '0'
    if digit >= 0 && digit <= 9 {
    line += bigDigits[digit][row]
    }
    }
    print(line)
    }
    }

    var bigDigits = [][]string{
    {" 000 ",
    " 0 0 ",
    "0 0",
    "0 0",
    "0 0",
    " 0 0 ",
    " 000 "},
    {" 1 ", "11 ", " 1 ", " 1 ", " 1 ", " 1 ", "111"},
    {" 222 ", "2 2", " 2 ", " 2 ", " 2 ", "2 ", "22222"},
    {" 333 ", "3 3", " 3", " 33 ", " 3", "3 3", " 333 "},
    {" 4 ", " 44 ", " 4 4 ", "4 4 ", "444444", " 4 ",
    " 4 "},
    {"55555", "5 ", "5 ", " 555 ", " 5", "5 5", " 555 "},
    {" 666 ", "6 ", "6 ", "6666 ", "6 6", "6 6", " 666 "},
    {"77777", " 7", " 7 ", " 7 ", " 7 ", "7 ", "7 "},
    {" 888 ", "8 8", "8 8", " 888 ", "8 8", "8 8", " 888 "},
    {" 9999", "9 9", "9 9", " 9999", " 9", " 9", " 9"},
    }