Compare commits

..

3 commits

3 changed files with 16 additions and 1 deletions

View file

@ -2,3 +2,6 @@
This repo contains the result of a masochistic chemical engineer. This repo contains the result of a masochistic chemical engineer.
https://adventofcode.com/ https://adventofcode.com/
### License
This repository is licensed under the MIT license unless otherwise specified.

View file

@ -19,3 +19,11 @@ Part 2 is written in Go and can only be ran on Linux, so it counts.
#### Part 2: #### Part 2:
0. (Optional) Compile `d4p2.go` 0. (Optional) Compile `d4p2.go`
1. Run the program specifying the input as the first command line argument. `go run d4p2.go input` or `./d4p2 input` 1. Run the program specifying the input as the first command line argument. `go run d4p2.go input` or `./d4p2 input`
### FAQ:
#### 1. Spreadsheets aren't a programming language!!!!!!!!!!!!!!!!!!
That's not a question.
#### 2. Aren't you cheating by not using a non-programming language such as a spreadsheet?
Don't care.
(Besides, it was harder this way)

View file

@ -1,4 +1,3 @@
// +build linux
package main package main
import ( import (
@ -8,6 +7,7 @@ import (
"os" "os"
"strings" "strings"
"regexp" "regexp"
"runtime"
) )
func find_num_wins(winners string, numbers string) int { func find_num_wins(winners string, numbers string) int {
@ -24,6 +24,10 @@ func find_num_wins(winners string, numbers string) int {
func main() { func main() {
if runtime.GOOS != "linux" {
panic("This is for Linux only.")
}
if len(os.Args) < 2 { if len(os.Args) < 2 {
panic("You did not specify an input file.") panic("You did not specify an input file.")
} }