C
C#12mo ago
Dinny

Fixing unscrambling file

I have this file to unscramble pixels in my input file to create the dutch flag in the output file, but for some reason, my output file is still scrambled.
1 Reply
ZacharyPatten
ZacharyPatten12mo ago
public static void Swap(List<Pixel> pixel, int index1, int index2)
{
Pixel temp = pixel[index1];
pixel[index1] = pixel[index2];
pixel[index1] = temp;
}
public static void Swap(List<Pixel> pixel, int index1, int index2)
{
Pixel temp = pixel[index1];
pixel[index1] = pixel[index2];
pixel[index1] = temp;
}
you have a glaring issue in this method the purpose of that method is to swap the positions of two items in the list yet, you only ever assign pixel[index1] a value you never assign pixel[index2] a value
Want results from more Discord servers?
Add your server