refactor: challenge files and explanations
This commit is contained in:
@ -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() {
|
||||
}
|
47
15-arrays-project-clock/01-printing-the-digits/main.go
Normal file
47
15-arrays-project-clock/01-printing-the-digits/main.go
Normal file
@ -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() {
|
||||
}
|
@ -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
|
||||
|
@ -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:
|
||||
//
|
@ -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
|
||||
|
@ -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() {
|
||||
}
|
@ -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() {
|
||||
}
|
Reference in New Issue
Block a user