aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/main.go b/main.go
index caf6d6b..a8db9ac 100644
--- a/main.go
+++ b/main.go
@@ -6,6 +6,8 @@ import (
"github.com/pkg/term"
"math/rand"
"time"
+ "os"
+ "strconv"
)
func pos(l, c int) {
@@ -52,6 +54,10 @@ func GetKey(t *term.Term) []byte {
}
func main() {
+ var startlevel int
+ if len(os.Args) > 1 {
+ startlevel, _ = strconv.Atoi(os.Args[1])
+ }
t, _ := term.Open("/dev/tty")
defer t.Close()
@@ -84,7 +90,11 @@ func main() {
level = 1
for {
x, y, rot = p.X, p.Y, p.Rot
- level = linescleared/10 + 1
+ if level > startlevel || linescleared > startlevel * 10 {
+ level = linescleared/10 + 1
+ } else {
+ level = startlevel
+ }
slevel := fmt.Sprintf("level %d", level)
sscore := fmt.Sprintf("score %d", score)
slines := fmt.Sprintf("lines %d", linescleared)