diff --git a/LICENSE.txt b/LICENSE.txt old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/go.mod b/go.mod old mode 100644 new mode 100755 diff --git a/go.sum b/go.sum old mode 100644 new mode 100755 diff --git a/scripts/diagonal.sh b/scripts/diagonal.sh new file mode 100755 index 0000000..8f4138f --- /dev/null +++ b/scripts/diagonal.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Вказуємо параметри руху вікна і фігури +startWinPositon=100 +finishWinPositon=700 +windowSize=800 +figureRadius=100 +maxDistance=600 +jmp=10 +timeInterval=0.01 +currPos=$startWinPositon +distance=0 + +# Відпрвляємо запит для створення вікна і фігури +curl -d "figure $startWinPositon $startWinPositon" http://localhost:17000 + +sleep $timeInterval + +while true; do + # Обноляєм координати фігури + curl -d "update" http://localhost:17000 + + # Рухаємо фігуру вліво + while (( currPos < finishWinPositon )); do + if ((distance >= maxDistance)); then + curl -d "move $((maxDistance-distance)) $((maxDistance-distance))" http://localhost:17000 + currPos=$finishWinPositon + distance=$maxDistance + else + curl -d "move $jmp $jmp" http://localhost:17000 + currPos=$((currPos + jmp)) + distance=$((distance + jmp)) + fi + curl -d "update" http://localhost:17000 + sleep $timeInterval + done + + # Рухаємо фігуру вправо + while (( currPos > startWinPositon )); do + if ((distance - jmp <= 0)); then + curl -d "move $((-distance)) $((-distance))" http://localhost:17000 + currPos=$startWinPositon + distance=0 + else + curl -d "move $((-jmp)) $((-jmp))" http://localhost:17000 + currPos=$((currPos - jmp)) + distance=$((distance - jmp)) + fi + curl -d "update" http://localhost:17000 + sleep $timeInterval + done +done \ No newline at end of file diff --git a/scripts/figure.sh b/scripts/figure.sh new file mode 100755 index 0000000..54e91a7 --- /dev/null +++ b/scripts/figure.sh @@ -0,0 +1,9 @@ +#!/bin/bash +curl -d "reset" http://localhost:17000 + +curl -d "white" http://localhost:17000 +curl -d "bgrect 200 200 600 600" http://localhost:17000 +curl -d "figure 400 400" http://localhost:17000 +curl -d "green" http://localhost:17000 +curl -d "figure 480 480" http://localhost:17000 +curl -d "update" http://localhost:17000 \ No newline at end of file diff --git a/scripts/green_board.sh b/scripts/green_board.sh new file mode 100755 index 0000000..0a9adf1 --- /dev/null +++ b/scripts/green_board.sh @@ -0,0 +1,12 @@ + +#!/bin/bash +curl -d "reset" http://localhost:17000 + +coordX1=10 +coordY1=10 +coordX2=790 +coordY2=790 + +curl -d "green" http://localhost:17000 +curl -d "bgrect $coordX1 $coordY1 $coordX2 $coordY2 $1" http://localhost:17000 +curl -d "update" http://localhost:17000 \ No newline at end of file diff --git a/scripts/reset.sh b/scripts/reset.sh new file mode 100755 index 0000000..483ff24 --- /dev/null +++ b/scripts/reset.sh @@ -0,0 +1,6 @@ + +#!/bin/bash + +curl -d "reset" http://localhost:17000 +curl -d "black" http://localhost:17000 +curl -d "update" http://localhost:17000 \ No newline at end of file