From 0a7422def7b9499f5afb97c47620f1cacd8357fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mikl=C3=B3s=20T=C3=B3th?= <tothmiklostibor@gmail.com>
Date: Sun, 25 Jun 2023 12:26:40 +0200
Subject: [PATCH] Add Pac-man

---
 cmd/tutter_pac/pacman.go | 48 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 cmd/tutter_pac/pacman.go

diff --git a/cmd/tutter_pac/pacman.go b/cmd/tutter_pac/pacman.go
new file mode 100644
index 0000000..592c793
--- /dev/null
+++ b/cmd/tutter_pac/pacman.go
@@ -0,0 +1,48 @@
+package main
+
+import (
+	"pp/pkg/tutter"
+	"time"
+)
+
+func main() {
+	lineLen := 20
+	pos := 0
+	dir := true
+
+	for {
+		line := ""
+
+		for i := 0; i < lineLen; i++ {
+			if i == pos {
+				if dir {
+					line += "🌜"
+				} else {
+					line += "🌛"
+				}
+			} else {
+				line += "🍎"
+			}
+		}
+
+		e := tutter.Send(line)
+		if e != nil {
+			panic(e)
+		}
+		time.Sleep(time.Second / 2)
+
+		if dir {
+			pos++
+		} else {
+			pos--
+		}
+
+		if pos >= lineLen-1 {
+			dir = false
+		}
+
+		if pos <= 0 {
+			dir = true
+		}
+	}
+}
-- 
GitLab