Commit 82e84692 authored by Samarth Joshi's avatar Samarth Joshi

Bug Fix: starting origin from (0,0)

parent bbb45764
sed 's/!/\n/g;s/-/ /g' $1 | awk '/^U/{y=y+$2; print "U\t("x","y")"} /^D/{y=y-$2; print "D\t("x","y")"} /^L/{x=x-$2; print "L\t("x","y")"} /^R/{x=x+$2; print "R\t("x","y")"} BEGIN {x=0;y=1} END {print "Final Position: ("x","y")"}'
sed 's/!/\n/g;s/-/ /g' $1 | awk '/^U/{y=y+$2; print "U\t("x","y")"} /^D/{y=y-$2; print "D\t("x","y")"} /^L/{x=x-$2; print "L\t("x","y")"} /^R/{x=x+$2; print "R\t("x","y")"} BEGIN {x=0;y=0} END {print "Final Position: ("x","y")"}'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment