From e8979057d4458babd9c7bf7e07a62b25ca02b671 Mon Sep 17 00:00:00 2001 From: Inanc Gumus Date: Sat, 15 Dec 2018 13:34:39 +0300 Subject: [PATCH] refactor: challenge files and explanations --- .../01-printing-the-digits/challenge/main.go | 53 ------------------- .../01-printing-the-digits/main.go | 47 ++++++++++++++++ .../{challenge => }/main.go | 28 +++------- .../{challenge => }/main.go | 16 +++--- .../{challenge => }/main.go | 13 ++--- .../exercises/00-text/main.go | 23 -------- .../exercises/00-text/solution/main.go | 11 ---- 7 files changed, 64 insertions(+), 127 deletions(-) delete mode 100644 15-arrays-project-clock/01-printing-the-digits/challenge/main.go create mode 100644 15-arrays-project-clock/01-printing-the-digits/main.go rename 15-arrays-project-clock/02-printing-the-clock/{challenge => }/main.go (67%) rename 15-arrays-project-clock/03-animating-the-clock/{challenge => }/main.go (89%) rename 15-arrays-project-clock/04-blinking-the-separators/{challenge => }/main.go (84%) delete mode 100644 15-arrays-project-clock/exercises/00-text/main.go delete mode 100644 15-arrays-project-clock/exercises/00-text/solution/main.go diff --git a/15-arrays-project-clock/01-printing-the-digits/challenge/main.go b/15-arrays-project-clock/01-printing-the-digits/challenge/main.go deleted file mode 100644 index 797a9ad..0000000 --- a/15-arrays-project-clock/01-printing-the-digits/challenge/main.go +++ /dev/null @@ -1,53 +0,0 @@ -// For more tutorials: https://blog.learngoprogramming.com -// -// Copyright © 2018 Inanc Gumus -// Learn Go Programming Course -// License: https://creativecommons.org/licenses/by-nc-sa/4.0/ -// - -package main - -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ -// ★ GOAL 1 : Printing the Digits -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ - -// - [ ] Define a new placeholder type - -// - [ ] Create the digits from "zero" to "nine" - -// - [ ] Put them into the "digits" array - -// - [ ] Print them side-by-side -// -// - [ ] Loop for all the lines in a digit -// -// - [ ] Print each digit line by line -// -// - [ ] Don't forget printing a space after each digit -// -// - [ ] Don't forget printing a newline after each line -// -// EXAMPLE: Let's say you want to print 10. -// -// ██ ███ <--- Print a new line after printing a single line from -// █ █ █ all the digits. -// █ █ █ -// █ █ █ -// ███ ███ -// ^^ -// || -// ++----> Add space between the digits -// -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ -// ★ Usable Artifacts -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ - -// Clock Characters: -// -// You can put these in constants if you like. -// -// Use this for the digits : "█" -// Use this for the separators : "░" - -func main() { -} diff --git a/15-arrays-project-clock/01-printing-the-digits/main.go b/15-arrays-project-clock/01-printing-the-digits/main.go new file mode 100644 index 0000000..5f79504 --- /dev/null +++ b/15-arrays-project-clock/01-printing-the-digits/main.go @@ -0,0 +1,47 @@ +// For more tutorials: https://blog.learngoprogramming.com +// +// Copyright © 2018 Inanc Gumus +// Learn Go Programming Course +// License: https://creativecommons.org/licenses/by-nc-sa/4.0/ +// + +package main + +// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ +// ★ GOAL 1 : Printing the Digits +// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ +// +// 1. Define a new placeholder type +// +// 2. Create the digits from "zero" to "nine" +// +// You can use these characters for the clock: +// +// Digit character : "█" +// Separator character : "░" +// +// 3. Put them into the "digits" array +// +// 4. Print the digits side-by-side +// +// 1. Loop for all the lines in a digit +// +// 2. Print each digit line by line +// +// 3. Don't forget printing a space after each digit +// +// 4. Don't forget printing a newline after each line +// +// EXAMPLE: Let's say you want to print 10. +// +// ██ ███ <--- Print a new line after printing a single line from +// █ █ █ all the digits. +// █ █ █ +// █ █ █ +// ███ ███ +// ^^ +// || +// ++----> Add space between the digits + +func main() { +} diff --git a/15-arrays-project-clock/02-printing-the-clock/challenge/main.go b/15-arrays-project-clock/02-printing-the-clock/main.go similarity index 67% rename from 15-arrays-project-clock/02-printing-the-clock/challenge/main.go rename to 15-arrays-project-clock/02-printing-the-clock/main.go index 3140ab3..61675ac 100644 --- a/15-arrays-project-clock/02-printing-the-clock/challenge/main.go +++ b/15-arrays-project-clock/02-printing-the-clock/main.go @@ -9,33 +9,17 @@ // ★ GOAL 2 : Printing the Clock // ★★★★★★★★★★★★★★★★★★★★★★★★★★★ // -// - [ ] Get the current time +// 1. Get the current time // -// - [ ] Get the current hour, minute and second from the current time +// 2. Get the current hour, minute and second from the current time // -// - [ ] Create the clock array +// 3. Create the clock array by getting the digits from the digits array // -// - [ ] Get the individual digits from the digits array +// 4. Print the clock by using the clock array // -// - [ ] Print the clock +// 5. Create a separator array (it's also a placeholder type) // -// - [ ] In the loops, use the clocks array instead -// -// - [ ] Create a separator array (it's also a placeholder) -// -// - [ ] Add the separators into the correct positions of -// the clock array -// -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ -// ★ Usable Artifacts -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ - -// Clock Characters: -// -// You can put these in constants if you like. -// -// Use this for the digits : "█" -// Use this for the separators : "░" +// 6. Add the separators into the correct positions of the clock array package main diff --git a/15-arrays-project-clock/03-animating-the-clock/challenge/main.go b/15-arrays-project-clock/03-animating-the-clock/main.go similarity index 89% rename from 15-arrays-project-clock/03-animating-the-clock/challenge/main.go rename to 15-arrays-project-clock/03-animating-the-clock/main.go index 81fa10c..3b96914 100644 --- a/15-arrays-project-clock/03-animating-the-clock/challenge/main.go +++ b/15-arrays-project-clock/03-animating-the-clock/main.go @@ -9,10 +9,10 @@ // ★ GOAL 3 : Animate the Clock // ★★★★★★★★★★★★★★★★★★★★★★★★★★★ -// - [ ] Create an infinite loop to update the clock +// 1. Create an infinite loop to update the clock // // -// - [ ] Update the clock every second +// 2. Update the clock every second // // time.Sleep(time.Second) will stop the world for 1 second // @@ -20,23 +20,23 @@ // https://golang.org/pkg/time/#Sleep // // -// - [ ] Clear the screen before the infinite loop +// 3. Clear the screen before the infinite loop // -// + Get my library for clearing the screen: +// 1. Get my library for clearing the screen: // // go get -u github.com/inancgumus/screen // -// + Then, import it and call it in your code like this: +// 2. Then, import it and call it in your code like this: // // screen.Clear() // -// + If you're using Go Playground instead, do this: +// 3. If you're using Go Playground instead, do this: // // fmt.Println("\f") // // -// - [ ] Move the cursor to the top-left corner of the screen, -// before each step of the infinite loop +// 1. Move the cursor to the top-left corner of the screen, before each step +// of the infinite loop // // + Call this in your code like this: // diff --git a/15-arrays-project-clock/04-blinking-the-separators/challenge/main.go b/15-arrays-project-clock/04-blinking-the-separators/main.go similarity index 84% rename from 15-arrays-project-clock/04-blinking-the-separators/challenge/main.go rename to 15-arrays-project-clock/04-blinking-the-separators/main.go index d813c9f..7db9b08 100644 --- a/15-arrays-project-clock/04-blinking-the-separators/challenge/main.go +++ b/15-arrays-project-clock/04-blinking-the-separators/main.go @@ -9,9 +9,7 @@ // ★ GOAL 4: Blinking the Separators // ★★★★★★★★★★★★★★★★★★★★★★★★★★★ -// - [ ] Blink the separators -// -// They should be visible per two seconds. +// They should be visible per two seconds. // // Example: 1st second invisible // 2nd second visible @@ -20,15 +18,10 @@ // // HINT: There are two ways to do this. // -// 1- Manipulating the clock array directly +// A- Manipulating the clock array directly // (by adding/removing the separators) // -// 2- Deciding what to print when printing the clock - -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ -// YOU CAN ALSO FIND THE FINAL SOLUTION WITH ANNOTATIONS: -// 05-full-annotated-solution -// ★★★★★★★★★★★★★★★★★★★★★★★★★★★ +// B- Deciding what placeholders to print when printing the clock package main diff --git a/15-arrays-project-clock/exercises/00-text/main.go b/15-arrays-project-clock/exercises/00-text/main.go deleted file mode 100644 index dc09d53..0000000 --- a/15-arrays-project-clock/exercises/00-text/main.go +++ /dev/null @@ -1,23 +0,0 @@ -// For more tutorials: https://blog.learngoprogramming.com -// -// Copyright © 2018 Inanc Gumus -// Learn Go Programming Course -// License: https://creativecommons.org/licenses/by-nc-sa/4.0/ -// - -package main - -// --------------------------------------------------------- -// EXERCISE: Text -// -// 1. Text -// -// HINT -// Text -// -// EXPECTED OUTPUT -// Text -// --------------------------------------------------------- - -func main() { -} diff --git a/15-arrays-project-clock/exercises/00-text/solution/main.go b/15-arrays-project-clock/exercises/00-text/solution/main.go deleted file mode 100644 index b5e729e..0000000 --- a/15-arrays-project-clock/exercises/00-text/solution/main.go +++ /dev/null @@ -1,11 +0,0 @@ -// For more tutorials: https://blog.learngoprogramming.com -// -// Copyright © 2018 Inanc Gumus -// Learn Go Programming Course -// License: https://creativecommons.org/licenses/by-nc-sa/4.0/ -// - -package main - -func main() { -}