add: new tictactoe game
add: testing to tictactoe rename: tictactoe add: tictactoe steps refactor: tictactoe const names refactor: tictactoe loop add: tictactoe bad switch example (fallthrough) refactor: tictactoe loop skin remove: tictactoe changable skin refactor: tictactoe all remove: tictactoe unnecessary base dir add: tictactoe slices add: tictactoe slices remove: tictactoe fallthrough rename: tictactoe slices 10 -> 09 update: loops skin tictactoe add: tictactoe randomization add: tictactoe infinite loop and labeled break refactor: tictactoe rand and infinite loop add: tictactoe buggy winning algo add: tictactoe more tests rename: tictactoe wrongPlay to wrongMove add: tictactoe even more tests fix: tictactoe rename: tictactoe waitForInput to wait add: tictactoe os.args gameSpeed remove: tictactoe unnecessary files rename: tictactoe game messages refactor: tictactoe main loop add: types and arrays
This commit is contained in:
51
x-tba/foundations/02-variables/types/main.go
Normal file
51
x-tba/foundations/02-variables/types/main.go
Normal file
@ -0,0 +1,51 @@
|
||||
// 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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// int, float64, bool, string
|
||||
var (
|
||||
cpus int
|
||||
path, dir string
|
||||
max float64
|
||||
)
|
||||
|
||||
cpus = runtime.NumCPU()
|
||||
path = os.Getenv("PATH")
|
||||
max = math.Max(1.5, 2.5)
|
||||
dir, _ = os.Getwd()
|
||||
now := time.Now()
|
||||
|
||||
// cpus := runtime.NumCPU()
|
||||
// path := os.Getenv("PATH")
|
||||
// max := math.Max(1.5, 2.5)
|
||||
// dir, _ := os.Getwd()
|
||||
|
||||
// dir = `"` + dir + `"`
|
||||
// dir = strconv.Quote(dir)
|
||||
// cpus++
|
||||
// cpus *= 2.5
|
||||
// max++
|
||||
// max /= 2.5
|
||||
// paths = strings.Split(path, ":")
|
||||
// path = paths[0]
|
||||
|
||||
fmt.Printf("# of CPUS : %d\n", cpus)
|
||||
fmt.Printf("Path : %s\n", path)
|
||||
fmt.Printf("max(1.5, 2.5) : %g\n", max)
|
||||
fmt.Printf("Current Directory: %s\n", dir)
|
||||
fmt.Printf("Current Time : %s\n", now)
|
||||
}
|
Reference in New Issue
Block a user