| 11-04-2007, 01:36 AM | #1 |
| 11-04-2007, 02:16 AM | #2 |
Sorry, I don't know GUI, pseudo code: Code:
For each (integer A) 1 to 20 do
set TempInt[(integer A) = (integer A)
For each (integer A) 1 to 8 do
set pos = Random number between 1 and 20
set x = TempInt[pos]
set TempInt[pos] = TempInt[(integer A)]
set TempInt[(integer A)] = x |
| 11-04-2007, 02:28 AM | #3 |
just run another loop to check them or store the number used in array index to check if they are used |
| 11-04-2007, 04:24 AM | #4 |
something like this? i guess... JASS:if TempInt[1]==TempInt[2] and TempInt[2]==TempInt[3]... and TempInt[7]==TempInt[8] then //your code here endif |
| 11-04-2007, 05:38 AM | #5 |
| 11-04-2007, 07:44 AM | #6 |
You must make integer pool and use numbers from this pool. Also you can use unitgroup with units 1-2-3-4-5 or item\unit pool |
| 11-04-2007, 11:58 AM | #7 |
Go ahead and ignore my simple algorithm with linear complexity... |
| 11-04-2007, 12:52 PM | #8 |
JASS:For each (integer A) 1 to 20 do set TempInt[(integer A) = (integer A) For each (integer A) 1 to 20 do set pos = Random number between 1 and 20 set x = TempInt[pos] set TempInt[pos] = TempInt[1] set TempInt[1] = x |
| 11-04-2007, 03:49 PM | #9 |
vex's algorithm is best, also the one i was trying to say |
| 11-04-2007, 03:55 PM | #10 | ||||
Tried this without success: Quote:
Quote:
Quote:
Quote:
|
| 11-04-2007, 04:21 PM | #11 |
Well we all know Vex does not know shit about programming :P haha, kidding, his algorithm is more optimized and it works, (assuming that you know how to implement it.) You proabably nested for A loops... Noob-friendly programming wins, yay. |
| 11-04-2007, 05:09 PM | #12 |
I followed this thread and I was skeptical of Vexs code. I just went through step by step writing down all values on paper and it work quite well, amazing. |
| 11-04-2007, 06:28 PM | #13 |
You can find an implementation of the only correct way to shuffle (what vex wrote) in DARY. |
| 11-04-2007, 07:31 PM | #14 | |
Quote:
"only correct way" I mean really.... |
| 11-04-2007, 10:09 PM | #15 |
damn tat simple thing vex wrote is so fucking complex... someone tell me in words wat it does pls... |
