Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Heres my actual code if this helps with any clues
const turnleft 0
const moveforward 1
const turnright 2
const useaction 4
const wall 1
const door 3
door
cp0to2
#cant go forward turn left
label turn
turnleft
cp0toout
#real "start" point, check front
label checkfront
turn
cp0to4
cpinto3
checkdoor
jnz #call checkdoor function
#seeing empty square move onto it
label forward
moveforward
cp0toout
#moved into empty square look left
label checkleft
turnleft
cp0toout
cpinto3
forward
jz
#wall/door on left
turnback
cp0to4
checkdoor
jmpi
#face forward again
label turnback
turnright
cp0toout
cpinto3
checkdoor
jnz #keep turning right until empty
#now empty in front
forward
jmpi
#subroutine to find the door
label checkdoor
cp3to1
sub
cp4to0 #return address
jnz
#TADA!
useaction #important!
cp0toout
Then doing the code strategy of using jumps and labels to be able to create a primitive function i would call them.
So encapsulate with example, function 1, like : label f1
and inside this at the end, close the function with jump to somewhere, usually the place you are going to jump should be right after you call the jump to enter this function.
that way you make your code jump to where it needs and come back to the line after the line it called for the function jump.
anyway, don`t remember now if the maze was using the leg or the overture, it matters not the strategy stays the same.
I could code a way to count the coins and only get out of the maze when have collected all the coins.
So it kind needs to get to the door a second time and in the first time it should look up for how many coins it has and only enter the door if the right amount is correct.
Because the amount of coins are all the same it can easily be done.
Also make use of constants, that will help you to code what you need.
Then what you have to do basically is to focus on functions and create function to each thing you need to get it done. The routine for the walking, you check if there is wall , look to the right or left and walk if you can, essentially the strategy is to fallow one of either sides of the wall, so you make a routine as such the robot will fallow that wall always.
Now inside that you need to make a call to test what you see, if it is a wall you call the next function which will be the nest step of walking, if it see a coin it needs to walk toward it, count that coin in saving it in a register, adding 1 to that specific register designed to be the counter of coins, then jump back to the walking process again.
if it is a door, you need to make a call for a function to verify if you have all the coins, if so you enter the door, if not go back to walking. and that is that.