Please note that the syntax may be completely different from any of 
programming languages you know. More specifically, indentation does not 
matter in this code, ":=" denotes the substitution, "=" is the equal 
comparator, and the condition in FOR statement is boundary-inclusive.

========
Initial state of an array "a":

[[4, 2, 4, 2], 
[4, NULL, 4, 2], 
[2, NULL, 8, 2], 
[16, NULL, 4, NULL]]

========
Main function:

FUNCTION foo()
FOR y := 0 to 3 
FOR x := 0 to 3
IF a[x+1][y] != NULL
IF a[x+1][y] = a[x][y]
a[x][y] := a[x][y]*2
a[x+1][y] := NULL
END IF
IF a[x][y] = NULL
a[x][y] := a[x+1][y]
a[x+1][y] := NULL
END IF
END IF
END FOR
END FOR
END FUNCTION

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/ee6ad0c4-429f-4589-844f-ecaca8d21897%40googlegroups.com.

Reply via email to