Skip to content

Commit

Permalink
added scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Illyakravchuk committed May 5, 2023
1 parent bbbe962 commit 78cb033
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 0 deletions.
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
Empty file modified Makefile
100644 → 100755
Empty file.
Empty file modified go.mod
100644 → 100755
Empty file.
Empty file modified go.sum
100644 → 100755
Empty file.
52 changes: 52 additions & 0 deletions scripts/diagonal.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions scripts/figure.sh
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions scripts/green_board.sh
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions scripts/reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#!/bin/bash

curl -d "reset" http://localhost:17000
curl -d "black" http://localhost:17000
curl -d "update" http://localhost:17000

0 comments on commit 78cb033

Please sign in to comment.