C
Chungsie
Guest
In my project, I have a room, called, room0 and an object called object0
and in step event it does
the for loop never runs, as verified by the values of complete1 and complete2 and the fact the array is printed exactly as it was initialized.
I've tried making a script.
It does not work. How will I do my homework, if my assignment is to take pseudocode and write a insertion_sort function for a given array, as if dealing with cards?
Code:
object0 initializes
cards = array_create(0,0)
cards = [9,8,7,2,3,4]
i = 0
j = 0
key = 0
complete1 =0
complete2 = 0
Code:
for (j = 2; j >= array_length_1d(cards); j += 1)
{
if complete2 == 0 complete2 = .5
key = cards[j]
i = j - 1
while (i > 0 and cards[i] > key)
{
cards[i - 1] = cards[i]
i -= 1
if complete1 == 0 complete1 = 1
}
cards[i + 1] = cards[i]
if j == array_length_1d(cards) complete2 = 1
}
I've tried making a script.
It does not work. How will I do my homework, if my assignment is to take pseudocode and write a insertion_sort function for a given array, as if dealing with cards?