Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Command: cut -d' ' -f-2 | tr 'RDLU' '0123' input | dc -fpart1.dc
- # ASSUME: Every line is a 90 degree turn (just swap x and y on the stack each time)
- 0d ? # y x dir len
- [
- r2~ # y x len upleft=dir/2 vert=dir%2
- 2*1- r2*1- # y x len vert=(1|-1) upleft=(1|-1)
- 3Rd lb+sb * # border += len; y x vert delta=upleft*len
- d 4R+ _4R # x+=delta y vert delta
- *r d3R * # x y vert*delta*y
- la+sa # area += vert * delta * y; x y
- ? z2<M
- ] dsMx
- [Part 1: ]n lad*v lb+ 2/ 1+p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement