aboutsummaryrefslogtreecommitdiff
path: root/challenge-123/abigail/awk/ch-2.awk
blob: 96ac5314b12ef7b91ec39034f3ec5484f214520e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/awk

#
# See ../README.md
#

#
# Run as: awk -f ch-2.awk < input-file
#

function dist (x1, y1, x2, y2) {(x1 - x2) ^ 2 + (y1 - y2) ^ 2}

{
    print (dist ($1, $2, $3, $4) == dist ($3, $4, $5, $6) &&
           dist ($3, $4, $5, $6) == dist ($5, $6, $7, $8) &&
           dist ($5, $6, $7, $8) == dist ($7, $8, $1, $2) &&
           dist ($1, $2, $5, $6) == dist ($3, $4, $7, $8) ? 1 : 0)
}