Author Topic: My Axe flood fill algorithm. [tutorial WIP]  (Read 2457 times)

0 Members and 1 Guest are viewing this topic.

c4ooo

• Posts: 252
• Rating: +10/-1
• The impossible chemical compound.
My Axe flood fill algorithm. [tutorial WIP]
« on: March 10, 2015, 10:03:06 pm »
This was originally intended as a tutorial, but it never worked out like a tutorial so lie just post the code and comment on what it does.

So i was bored in math class and decided to implement a flood fill algorithm. It was actually much easier then i though
This is probably not the most efficient flood fill out there, as i thought of it myself . So yea: (ps the algorithm requires a second 768 (786?) byte buffer.) (pps i thought of the algorithm my self but it may be pretty standard  )
It seems pretty fast to me, but i don't know how fast it is compared to others. Ile try to post pics soon. So here is the code:
Code: [Select]
.FloodFill.PROGRAM START, CALLS FLOOD FILL ON CORDS 48,32DiagnosticOffFullClrDraw^rrFLOODFILL(48,32)DispGraphText(0,0,"Over"Repeat getKeyEndReturnLbl FLOODFILLr1->Xr2->Y0->D+1->ZPxl-On(X,Y)Pxl-On(X,Y)^rRepeat getKey(1)If HIT(Z)TURN()->Z!If ZJUMP()!If ZReturnEnd EndEndMOVEX()->XMOVEY()->YD+1^1024-D!If DDispGraphEndEndReturnLbl JUMPFor(F,0,95)For(G,0,63)If pal-Test(F,G)^rF->XG->YTURN()->Zif ZReturnEndEndEndEnd0->ZReturnLbl TURNFor(T,1,4!If HIT(T)TReturnEndEnd0ReturnLbl HIWMOVEX(r1)->IMOVEY(r1)->JIf pxl-Test(I,J)??I<0??I>95??J<0??J>631ReturnEnd0ReturnLbl MOVEXIf r1=1x+1ReturnElseIf r1=3X-1ReturnEndxReturnLbl MOVEYif r1=2Y-1ReturnElseIf r1=4Y+1ReturnEndYReturnFew that was longâ€¦ now i have to indent and comment the code!
« Last Edit: March 12, 2015, 06:32:28 pm by c4ooo »
-German Kuznetsov
The impossible chemical compound.