From 249fcf5f7ea2b7f4da033308360166e5231d5e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jasper=20R=C3=A4disch?= Date: Fri, 5 Jan 2018 08:42:46 +0100 Subject: [PATCH] add margins and clears; add license --- LICENSE | 21 +++++++++++++++++++++ main.go | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..19eb06e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Jasper Rädisch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/main.go b/main.go index 047b7ad..4350040 100644 --- a/main.go +++ b/main.go @@ -14,20 +14,47 @@ import ( ) func main() { + clearScreen() + marginTop() + marginLeft() + fmt.Println("Add/edit players.csv in the same folder as this binary (one name per line, no commas).") + marginLeft() + fmt.Println("Press Enter when ready!") + marginLeft() + readInput() names := readNames("players.csv") shuffled := shuffleNames(names) victims := distributeVictims(shuffled) - fmt.Println("\n\n\n\nPress Enter when ready!") - readInput() for _, murderer := range names { victim := victims[murderer] clearScreen() - fmt.Printf("\n\n\n\nNext victim is for %s's eyes only! (press Enter if you are %s)", murderer, murderer) + marginTop() + marginLeft() + fmt.Printf("Next victim is for %s's eyes only! (press Enter if you are %s)\n", murderer, murderer) + marginLeft() readInput() - fmt.Printf("Your victim is: %s\nPress Enter if you wrote it down!", victim) + clearScreen() + marginTop() + marginLeft() + fmt.Printf("Your victim is: %s\n", victim) + marginLeft() + fmt.Println("Press Enter if you wrote it down!") + marginLeft() readInput() } + clearScreen() + marginTop() + marginLeft() fmt.Println("All victims have been distributed :)") + marginTop() +} + +func marginTop() { + fmt.Print("\n\n\n\n") +} + +func marginLeft() { + fmt.Print(" ") } func distributeVictims(names []string) map[string]string {