generated from roman-mazur/architecture-lab-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbbe962
commit 78cb033
Showing
8 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |