2022-02-13
Part of my journey through Shenzhen I/O
Problem: Read a value off of p0
, multiply it by 2, and place it on p1
.
This is the first time we're reading from an input, doing a transform, and putting it on on output, but it's as simple as it's going to get, since there are instructions available for each step:
mov p0 acc
add acc
mov acc p1
slp 1
Cost is ¥3, power usage is 240, and 4 lines of code are necessary.