Turing Complete

Turing Complete

View Stats:
Zednaught Jun 29, 2022 @ 1:45pm
Constants and Labels?
Hey, I've just reached the part of the game where we do programming challenges. I've completed 3 of them, and I have 3 to go. I think I need to start using Constants and Labels, but I don't really have any idea how to get started with them. The game assumes that I know what they are, and just gives the syntax for using them, but no explanation for their function (something to be improved on before the full release).

Would some kind person be able to write a simple explanation?

I've beaten all the Zachtronics games, so I understand the principle of creating loops, for example, but it's not clear how exactly what a label does in this game. Constants I wouldn't even know where to get started--what's a value, exactly?

Thanks for any help.
< >
Showing 1-12 of 12 comments
SunCat Jun 29, 2022 @ 1:52pm 
you should have a manual page called Assembly
Last edited by SunCat; Jun 29, 2022 @ 1:52pm
Zednaught Jun 29, 2022 @ 2:08pm 
Originally posted by SunCat:
you should have a manual page called Assembly

I'm sorry, but this is not a good answer. I have read the manual--it's a one line description for each that doesn't provide any substantial information or context. That's what my post is asking for.

I don't think it's adequate for anyone who hasn't already been taught what those terms mean. The manual is quite useful for other entries, so the barebones nature of this sticks out.



Last edited by Zednaught; Jun 29, 2022 @ 2:11pm
UnsignedRobin Jun 29, 2022 @ 2:20pm 
A constant is an alias for a number. (binary, hex or decimal)
const up 3 const wait 4 const shoot 6 const always 0b11000100
You can use that alias to refer to that number anywhere in the code.

A label is also just a number. It is the counter-number of the following code-line, and can also be used anywhere in the code. Use that label to write its value to the counter by either using a condition or copy the label directly to the counter. Overwriting the counter value is a "jump", because you continue from a different point in the program.
label checkForRats in_to_reg3 # CodelineNo = 12 (example), use "checkForRats" to get 12 doNothing if_zero # doNothing is also a label further down, jump if condition is met shoot reg0_to_out checkForRats always label doNothing wait reg0_to_out checkForRats always
Last edited by UnsignedRobin; Jun 29, 2022 @ 2:29pm
SunCat Jun 29, 2022 @ 2:36pm 
a 'value' in math is:
a numerical quantity that is assigned or is determined by calculation or measurement
let x take on positive values
a value for the age of the earth

in programming, value doesn't have to be strictly a number, just any data (which on the lowest level still happens to be all numbers, 'cos computers), that is assigned to variables or constants, or is returned by a program, a function, or is a result of a calculation.
Zednaught Jun 29, 2022 @ 3:14pm 
Thank you very much--that was really helpful. I think that gives me what I need to proceed. I see how I can use those features to set up conditional loops, which'll be useful for the safecracking and robot puzzles.
Zednaught Jun 30, 2022 @ 5:56am 
Well, I was able to complete the maze level. I'm sure I'll have more questions as I get deeper into the game, but thanks again!
pet4032 Feb 17, 2023 @ 4:56am 
So the const values when used are automagically put into register 0?
UnsignedRobin Feb 17, 2023 @ 5:26am 
Yes (if they are lower than 64). Because when the value of the const is 63 or less, its binary value starts with 00 <-- which is the OPCODE for an immediate value (and all immidiate values go in REG0)
Last edited by UnsignedRobin; Feb 17, 2023 @ 5:27am
Al3xander Mar 5, 2023 @ 9:02pm 
const is a number
label is like the name of the function
If a condition of jump is true, jump to this label
How configure the jump if different for OVERTURE and LEG
All a label does is insert a number into the program that you don't need to calculate by hand.
BoredFlamingo Mar 6, 2023 @ 9:22pm 
In a, possibly futile attempt, to be clear. A label is an alias for the address of the instruction it precedes (it is not itself an instruction). If you add or delete instructions the assembler will alter the value of the label, where constants are not altered by the assembler.
Stoopha Aug 9, 2024 @ 12:14am 
thanks
Last edited by Stoopha; Aug 9, 2024 @ 12:20am
< >
Showing 1-12 of 12 comments
Per page: 1530 50