diff options
| author | Thomas Voss <thomasvoss@live.com> | 2021-12-13 11:21:48 +0100 | 
|---|---|---|
| committer | Thomas Voss <thomasvoss@live.com> | 2021-12-13 11:21:48 +0100 | 
| commit | 4f5b004db9a93d9ff356cdd3e6a9fa40421628a7 (patch) | |
| tree | e1cf8e43a6a177fe2eb71a9898a7644dd60c620d /2021 | |
| parent | 6ac8a3361689527642b81770be1d74da52962eb0 (diff) | |
Make code less shit
Diffstat (limited to '2021')
| -rw-r--r-- | 2021/13/puzzles.awk | 17 | 
1 files changed, 3 insertions, 14 deletions
diff --git a/2021/13/puzzles.awk b/2021/13/puzzles.awk index 2450eab..8c149d7 100644 --- a/2021/13/puzzles.awk +++ b/2021/13/puzzles.awk @@ -7,24 +7,13 @@ BEGIN           { FS = ",|=" }  flag == 1 { next }  # END PART 1 -/x/ { +/x|y/ {  	for (y in grid) {  		for (x in grid[y]) { -			if (x * 1 > $2) { +			if ($1 ~ /x/ && x * 1 > $2) {  				delete grid[y][x]  				grid[y][$2 - (x - $2)] = 1 -			} -		} -	} -	# START PART 1 -	flag = 1 -	# END PART 1 -} - -/y/ { -	for (y in grid) { -		if (y * 1 > $2) { -			for (x in grid[y]) { +			} else if ($1 ~ /y/ && y * 1 > $2) {  				delete grid[y][x]  				grid[$2 - (y - $2)][x] = 1  			}  |