[i]FLOODIT
Data(1,231,224,240,7,31,16,96,79->COLORS

// Start graphics canvas and display rectangle outline
Begin
Rectangle_NoClip(119,79,82,82

// Fill the rectangle with random squares
For(TILE,0,63
	remainder(rand,8->*{L1+TILE->COLOR
	SetColor(*{COLORS+COLOR
	FillRectangle_NoClip(120+10*remainder(TILE,8),80+TILE/8*10,10,10
End
0->X->Y
GetPixel(120,80->BASICCLR
Repeat KEY=15
	// Get the color of the current selected square, and display the cursor
	GetPixel(121+10*X,81+10*Y->CURCOLOR
	SetColor(222
	Rectangle_NoClip(120+10*X,80+10*Y,10,10
	If getKey->KEY
		// Erase the cursor with the current color
		SetColor(CURCOLOR
		Rectangle_NoClip(120+10*X,80+10*Y,10,10
		
		// Update cursor position
		X+(KEY=3 and X!=7)-(KEY=2 and X->X
		Y+(KEY=1 and Y!=7)-(KEY=4 and Y->Y
		
		// Fill with new color
		If KEY=9 and CURCOLOR!=BASICCLR
			1->DEPTH-1->*{L3+1}->*{L4+1
			Repeat DEPTH=0
				*{L3+DEPTH->XTEMP
				*{L4+DEPTH->YTEMP
				DEPTH-1->DEPTH
				
				// If the searched square matches the color, check all the neighbours
				If BASICCLR=GetPixel(120+10*XTEMP,80+10*YTEMP
					If XTEMP
						DEPTH+1->DEPTH
						XTEMP-1->*{L3+DEPTH
						YTEMP->*{L4+DEPTH
					End
					If YTEMP
						DEPTH+1->DEPTH
						XTEMP->*{L3+DEPTH
						YTEMP-1->*{L4+DEPTH
					End
					If XTEMP!=7
						DEPTH+1->DEPTH
						XTEMP+1->*{L3+DEPTH
						YTEMP->*{L4+DEPTH
					End
					If YTEMP!=7
						DEPTH+1->DEPTH
						XTEMP->*{L3+DEPTH
						YTEMP+1->*{L4+DEPTH
					End
					FillRectangle_NoClip(120+10*XTEMP,80+10*YTEMP,10,10
				End
			End
			
			// Check if the entire screen is filled with one color
			CURCOLOR->BASICCLR
			For(XTEMP,0,7
				For(YTEMP,0,7
					If GetPixel(120+10*XTEMP,80+10*YTEMP)!=BASICCLR
						Goto NEXT
					End
				End
			End
			Goto STOP
			Lbl NEXT
		End
	End
End
det(1
Return

Lbl STOP
det(1
ClrHome
Output(4,9,"You won! :D"