ochadenas / cpudefense

A tower defense game for Android based on a microprocessor theme
MIT License
118 stars 10 forks source link

SPLT duplicates a 0 (v1.33) #140

Closed Kutabu closed 6 months ago

Kutabu commented 6 months ago

SPLT duplicates a 0.

ochadenas commented 6 months ago

Yes. Shouldn't it?

Kutabu commented 6 months ago

If you want to remain consistent in the binary computer setting, then yes. A bit is the smallest unit and can therefore no longer be divided. So SPLT should neither divide a 1 nor a 0 if the attacker has only one digit. A multiple digits attacker like 01 may be divided into 0 and 1, this makes sense.

I have not yet checked the code to see if there is an easy way to recognise how many digits an attacker has. Maybe this is hardly realisable.

ochadenas commented 6 months ago

I prefer leaving it that way. I have no logical problems with x00 splitting into x00 and x00. Just as, say, xA4 splits into xA0 and x04. Anyways, if you OR the result together, you'll get the original number, so the mathematics are satisfied.