View Single Post
Old 03-20-2006, 11:19 AM   #6 (permalink)
feelgood
Free Mars!
 
feelgood's Avatar
 
Location: I dunno, there's white people around me saying "eh" all the time
I and J is suppose to end at 1 since the number on the column and letter at the top row is also part of the array. Don't ask me why, I'm just doing what my instructor told me to do.

I fixed the issue, it was pretty stupid since I was only bringing down whatever was above the row and then move on without considering the fact that the above row was also X.

Code:
private void collapseRow() {
	for(int i = ROW_LIMITS; i > 0; i--) {
		for(int j = COLUMN_LIMITS; j > 0; j--) {
			if(grid[i][j] == "X") {
				for(int k = i; k > 0; k--) {
					if(grid[k][j] != "X") {
						grid[i][j] = grid[k][j];
						grid[k][j] = "X";
						break;
					}
				}
			}
		}
	}
}
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war
feelgood is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73