Carbine Target Illuminator

Shenzhen I/O: Carbine Target Illuminator

Once again we are going to make equipment for military use. Someone in the company is not going to be happy about it. This time it is a Carbine Target illuminator, so we can see the bad guys before we shoot them. With the use of radar we are going to measure the distance to the bad guy by counting the number of cycles between output and input to the radar. Based on that we will turn on the laser sight and or the flood light in the following configuration.

Shenzhen I/O - Carbine target Illuminator - specification


If we can cram all the code into one MC6000 we should be able to do it with the following structure on the problem.

shenzhen io - carbine target illuminator structure

That would leave us with a price of 7¥ which is pretty respectable.

Coding the Carbine Target Illuminator

First we need to code something that will reset the counter on a radar-out signal and increase the count when we don’t receive anything on the radar in. That can be done with the follow bits.

slp: slp 1
  tcp x0 10
- add 1
- jmp slp
+ mov 0 acc
+ jmp slp

That will do exactly what we need and only continue if we get something on the radar-in.

The rest of the code is mostly trivial to write, all we need is to go through and check how long we waited and then set the output as needed.

  mov 1 x3
  mov 0 p1
  tgt acc 1
+ mov 10 x3
+ mov 50 p1
  tgt acc 3
+ mov 0 x3
+ mov 100 p1

All in all the solution looks likeshenzhen io - carbine target illuminator solution


This gives us a solution in

Cost: 6¥
Energy: 211
Lines of code: 14

Which is the lowest possible production cost, but the lines of code and energy usage could be lower. If they can with this structure I don’t know. I haven’t found better solutions than this. I tried fiddling around with the latter part where we set the outputs, but I haven’t figured out a way to improve it.

Posted by Kristian


I luv your solution of this problem! Thx a lot!

I had a build that was slightly worse than yours in terms of energy, but thanks to your clever use of tcp I was able to reduce it below the specs you provided, for 2 extra¥(with an added ROM)

add 7 lets us swap to the right column on the ROM, effectively letting us emulate 2 inputs in one tick, and we don’t even need to substract because mov 0 acc takes care of it for us.

We end up squeezing just below 200 power usage with only 11 lines of code

I realize this is an old post, but I was comparing my own solution with others I found online. There actually is a way to slightly improve this.

You can connect p2 to laser and replace the last line with just + mov 100 x3 – this will both set laser to 100 and zero the rest. This solution uses 208 energy and 13 loc while keeping the price at 7.

Just a little trick I thought was neat 🙂

Hi, I just bought this game (last week) and managed to achieve 6¥/ 208 power / 9 lines of code only.
Here’s my code, I let you figure out the rest 🙂

mul x0
teq p0 100
+ dgt 1
+ mul 50
+ mov acc p1
+ sub 100
+ mov acc x1
– add 4
slp 1

Leave a Reply