Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Konfigurasi lingkaran radius=10 # Radius lingkaran
- scale=2 # Skala horizontal untuk memperbaiki rasio aspek
- # Loop menggambar lingkaran
- for ((y = radius; y >= -radius; y--)); do
- for ((x = -radius * scale; x <= radius * scale; x++)); do # Hitung jarak titik (x, y) dari pusat (0, 0)
- distance=$(echo "sqrt(($x / $scale)^2 + $y^2)" | bc -l)
- # Variasikan karakter berdasarkan jarak dari radius
- if (( $(echo "$distance <= $radius + 0.3 && $distance >= $rad>
- echo -n "#"
- elif (( $(echo "$distance <= $radius + 0.6 && $distance > $ra>
- echo -n "="
- elif (( $(echo "$distance >= $radius - 0.6 && $distance < $ra>
- echo -n "="
- else
- echo -n " "
- fi
- done
- echo # Pindah ke baris berikutnya
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement