プレイ日記
NagatoYuki newtonyic1
i'm trying to make a slidepuzzle.but i can't figure out an algorithm on how to make blank space move to numberposition and randomnumber-numberposition move to where spaceblank was without messing the number.
6そうだね
プレイ済み
返信[1]
親投稿
PChicken NerdChicken
You don't know how to move the numbers?
0そうだね
プレイ済み
返信[2]
親投稿
NagatoYuki newtonyic1
i know hot to move blank space up,down,left,right and adjacent number back to blank space but i need a pattern that doesn't mess my order.i can't explain it.
0そうだね
プレイ済み
返信[3]
親投稿
PChicken NerdChicken
Well, it will be pretty hard to help you then.
0そうだね
プレイ済み
返信[4]
親投稿
I made a simple slider puzzle for you. I'ts a bit complex, but It might help you. Key: D5WE5EKV
1そうだね
プレイ済み
返信[5]
親投稿
NagatoYuki newtonyic1
thanks but i need a simple algorithm on my numbers order that when i move them i don't mess up
0そうだね
プレイ済み
返信[6]
親投稿
Publish the game, and i'll see what I can do.
0そうだね
プレイ済み
返信[7]
親投稿
NagatoYuki newtonyic1
my coding might be messy i'm not that advanced.try using ifs and then commands
0そうだね
プレイ済み
返信[8]
親投稿
NagatoYuki newtonyic1
just like you did it.that's how i want it to do.
0そうだね
プレイ済み
返信[9]
親投稿
I combined the look of your program with the mechanics of mine. Key: JK4NYE4S
1そうだね
プレイ済み
返信[10]
親投稿
NagatoYuki newtonyic1
i'll check
0そうだね
プレイ済み
返信[11]
親投稿
NagatoYuki newtonyic1
its too complex for me. i wanted to work with my coding form could you help me
0そうだね
プレイ済み
返信[12]
親投稿
I'll try in a bit. I'm going to spend some time with my relatives.
0そうだね
プレイ済み
返信[13]
親投稿
NagatoYuki newtonyic1
ok
0そうだね
プレイ済み
返信[14]
親投稿
I'm back! I looked over your code, and I don't completely understand it. But, I did find the glitch (In the screen shot). Unfortunately, the way you programed it only works 50% of the time. This is because of the way that slider puzzles work. I'll start looking for a simple solution to this glitch.
0そうだね
プレイ済み
返信[15]
親投稿
NagatoYuki newtonyic1
those are just for checking if the randomised number is the same as the other ones and repeats the rndmization
0そうだね
プレイ済み
返信[16]
親投稿
I know what that part of the code if for. Anyway, I found a VERY complex algorithm to find if the puzzle can be solved. I'll help you implement it into your program.
0そうだね
プレイ済み
返信[17]
親投稿
NagatoYuki newtonyic1
is your way the best,easiest way to do a slidepuzzle?i mean do i have to learn your sliderpuzzle coding.
0そうだね
プレイ済み
返信[18]
親投稿
NagatoYuki newtonyic1
must i have to?it'll take me surmount of time
0そうだね
プレイ済み
返信[19]
親投稿
Do you want to learn how my slider puzzle works, or do you want me to help you on yours?
0そうだね
プレイ済み
返信[20]
親投稿
NagatoYuki newtonyic1
both.is it to much to ask?
0そうだね
プレイ済み
返信[21]
親投稿
No I was just confused. I'll start explaing.
0そうだね
プレイ済み
返信[22]
親投稿
The first command here is ACLS. ts is used to reset all of the visual data.
1そうだね
プレイ済み
返信[23]
親投稿
Next you will see all of the data for the numbers. The last one is filled with spaces so I don't half to clear the text every time I move a piece. The numbers are simply overwritten with blank spaces.
0そうだね
プレイ済み
返信[24]
親投稿
NagatoYuki newtonyic1
ok. what does 'data' do?or what is it doing with the text numbers
0そうだね
プレイ済み
返信[25]
親投稿
Next you will find the DIM command. This is used to create arrays. Arrays are simply sets of organized variables. Next you'll find the FOR command this allows you to go through a set of numbers. after the two FOR commands you will find the READ command. this command reads the data up above. finally there is the CX and CY variables. these determine the location of the blank space in the puzzle.
0そうだね
プレイ済み
返信[26]
親投稿
The DATA command stores information in the code.
0そうだね
プレイ済み
返信[27]
親投稿
I forgot. The NEXT command ends the FOR command. Also, the third FOR command and the M variable sets the puzzle at the starting position.
0そうだね
プレイ済み
返信[28]
親投稿
PChicken NerdChicken
DATA stores information in a stack that you can load into variables or arrays with READ. This "stack" is basically a list of numbers or strings, data as we will call it. @SPECIALDATA 'Optional DATA 12,"LOL",15,16 This is a label, and a data stack assigned to a DATA command. Optional: Use RESTORE @SPECIALDATA to tell SmileBASIC that you want to READ starting from that label.
0そうだね
プレイ済み
返信[29]
親投稿
PChicken NerdChicken
Then, you can use READ VARIABLE to assign the first piece of data on the stack, 12, to the variable given to the READ command. Imagine that the 12 was removed from the list of data. Next up is "LOL". You will need a string variable to assign this data to. Let's call it STRINGVAR$. READ STRINGVAR$ will assign such data to the STRINGVAR$ string var. Note: Not using RESTORE will make the READ command
0そうだね
プレイ済み
返信[30]
親投稿
PChicken NerdChicken
start reading from the beginning of the code.
0そうだね
プレイ済み
返信[31]
親投稿
Next, you'll find @RESET. This represents the reset point. After that there is the GOSSUB command inside the FOR loop. This command goes to the specified label until it finds the RETURN command. Then it heads back. The second FOR command is so set the CX and CY variables back at coordinates (2,2).
0そうだね
プレイ済み
返信[32]
親投稿
Next is this set of question marks. You probably know that they act just like the PRINT command. Anyway, this displays the inital box.
0そうだね
プレイ済み
返信[33]
親投稿
Next is the main loop. It starts off with the REPEAT command. This command along with the UNTIL command creates a loop until the specified equation is true. Next there is the CHK variable. this is used to check if the puzzle is solved. Then there is the first FOR command used to find the value of the coordinate. The Second FOR command is used to find the value of the number. Next-
0そうだね
プレイ済み
返信[34]
親投稿
If the values are equal, then the number will be displayed. And the value will be checked to see if it is in it's original location. After that there are the BUTTON commands. these are used to detect if a button was just pressed on that frame. If the value is true then it will goto the specified label and skip the rest of the BUTTON commands. Next is the VSYNC which is used to slow the program.
0そうだね
プレイ済み
返信[35]
親投稿
Next is the UNTIL command. In this case, it is used to detect when the puzzle is finished. If the value is true then it will continue to the BGMPLAY command whis is used to play music and simple tunes. The WAIT command waits for two seconts, and finally procedes to reset the game. The @M(0-3) are the different moves that can be performed. I'll explain everything you need in greated detail tomorrow
0そうだね
プレイ済み
返信[36]
親投稿
I know you have PLENTY of questions. So start listing them off.
0そうだね
プレイ済み
返信[37]
親投稿
NagatoYuki newtonyic1
why you have cy>2 and cy<0?also what does swap do and the variables after that
0そうだね
プレイ済み
返信[38]
親投稿
The SWAP command swaps the values of two variables. The CY<2 and CY>0 make sure that the blank space is inside the box after the move. So, if you press right on the D-Pad, it checks to see if the blank space is greater than zero. If the value is true, the it will swap the values of the blank space with the one to the left of it. Then it will move the blank space one to the left with CX=CX-1.
0そうだね
プレイ済み
返信[39]
親投稿
NagatoYuki newtonyic1
what does 'true' means
0そうだね
プレイ済み
返信[40]
親投稿
An equation with two sides can be true or false. For example, the inequality 2>0 is true while 0>0 is false.
0そうだね
プレイ済み
返信[41]
親投稿
PChicken NerdChicken
Equations MUST always, no matter what, be equal. Otherwise, they are inequations, which are never equal. 12 = 12 What you mean is a comparison. Comparisons include both equations and inequations. They can be true or false. [12 = 12](12 Equals 12)TRUE [12 < 13](12 is Less than 13)TRUE [12 < 12](12 is Less than 12)FALSE [12 != 13](12 Doesn't equal 13)TRUE [12 != 12](12 Doesn't equal 12)FALSE
1そうだね
プレイ済み