It's not about C, it's about logic. Here, I'll put it in a different way:
Question: You have to generate all 3-digit numbers possible using 1, 2 and 3, without repeating anyone. So 123, 231, 132... are allowed, but 112, 222, 331 aren't allowed. So technically, there are 6 possible combinations:
123
132
213
231
312
321
All I did was put the first number constant and changed the other two numbers, I did that for 1, 2 and 3. So there are 6 possible combinations. Now, we have to use RGSS to generate, say print those 6 numbers using only loops and swapping.
Here's what swapping does:
| Spoiler: |
| |
| Code: | def swap(a, b) temp = a a = b b = a end |
So what that does this do? Let's say
| Code: | @one_var = 2 @two_var = 6
p @one_var p @two_var |
That will give two prompt windows saying '2' and '6'
Now you swap the values after declaring them and this will be the result:
| Code: | @one_var = 2 @two_var = 6
swap(@one_var, @two_var)
p @one_var p @two_var |
Result will be '6' and '2'
|
So here's the template, in a manner of speaking. It's the loop function in RGSS, I think you know it:
| Code: |
for i in 1 to 3 for j in 1 to 3 for k in 1 to 3 <mystery code which involves swapping of variables, but don't know WHICH variables> end end end |
So. I need that code inside the three loops.