0 Members and 1 Guest are viewing this topic.
.FLOOD.The challenge is to write a good,solid floodfill function.DiagnosticOff.Cursor coordinates10->X->Y.Start the program with the cursor at 10,10.The arrow keysmove the cursor.When you pressALPHA, call the flood fill function.When you press2ND,it draws a pixel at the X,YpositionClrDrawClrDraw^^r.Clear exitsRepeat getKey(15) .This code is unoptimized,and I use a lot of functions, for clarity purposes Input() .^All this function does is getinput from the arrow keys .Now,to get input from 2ND and ALPHA .Remember- .2ND=Draw pixel .ALPHA=Flood fill .And [DEL] deletes pixels If getKey(54) Pxl-On(X,Y)^^r End If getKey(56) Pxl-Off(X,Y)^^r End .Now,its your turn to write some code. .All I need is someone to writethe Flood() function. If getKey(48) Flood() .^That. .Scroll down tosee what code needs to be written. End .Now,for some boring display stuff .Everything is stored on the back buffer .The front buffer is for displaying the cursor and other stuff RecallPic .Display cursor Cursr() DispGraph Pause 75 .End of main loopEndReturn.Finally,the flood fill function!Lbl Flood.YOUR.CODE.HERE.Remember, dontwrite to the front buffer,usethe back bufferReturn.Other functionsLbl InputIf getKey(1) and (Y<63 Y++EndIf getKey(2) and (X>0 X--EndIf getKey(3) and (X<95 X++EndIf getKey(4) and (Y>0 Y--EndReturnLbl CursrRect(X,0,1,63Rect(0,Y,95,1Pxl-Off(X,YReturn
I don't know anything about Axe... Does it allow recursive functions ? If yes, it's really easy...Anyway, Wikipédia is really interesting about that.http://en.wikipedia.org/wiki/Flood_fill