IdeaMonk

thoughts, ideas, code and other things...

Monday, February 15, 2010

Nincompoop goes Linux

Ah! more than a year ago I wrote this yet to be finished 2d sidescrolling game with very crappy collision detection and pretty poorly programmed, blah blah called NinCompoop - The Unfinished Quest.

I felt like porting it to linux today. The good news is that allegro is already in the Ubuntu repository, so all I needed to do was a sudo apt-get install liballegro4.2.-dev

Porting again, was dead simple, just change the windows styles slashes to linux style slashes - \\ to /

So here we are, time for a demo -



Fork it here - http://github.com/ideamonk/Nincompoop, a request plz don't complain about ze lameness of teh code.

Labels: ,

Tuesday, April 07, 2009

Nincompoop is on Allegro.cc :)

I had almost forgotten what I submitted on Allegro.cc 2 months back!
Just got a mail today from Depot Manager on Allegro.cc saying the "Paint Daubs effect in Allegro" and "Nincompoop - The Unfinished Quest" has been added to Projects :)
Checkout http://www.allegro.cc/depot/Nincompoop-TheUnfinishedQuest/

I wish they have another PWNED! (game-dev) contest this year @ Shaastra 2009. Would love to play around some physics engines and XNA this time nopes Pyglet and Pymunk (python port of chipmunk) would be more satisfactory personally. Wish to get into another hacking contest too, just for some faltooo cash :)

Yippeeee!

Labels: , ,

Wednesday, October 01, 2008

Optimization by Memoization ( not memorization )

To iterate is Human, to Recurse, to Recurse, Divine - unknown

Solving COINS at spoj was a great lesson in recursion. Beautiful may the recursive code seem, but in some cases it is slow as a snail in worst case scenario. Consider finding nth Fibonacci by recursion as an example! And in some cases as in finding p^q, recursion is truly divine god's gift ;P.
Same is the case with COINS, its pretty easy to figure out the function that gets the job done... but give it something like n = 1000000000, poof! it vanishes into a deep slumber!
So, how can we make it work faster... ?
Have you ever noticed that, kids are asked to remember multiplication tables from 2 to 10 when in primary mathematics classes! Ever wondered why to do this mugging up at such a tender age. The answer is in... how we multiply two big numbers (abcd * pqrs). Here every digit i & j is in range of 0 through 9. So, if you've memorized multiplication table for 2 to 9, it will be very easy to get through (abcd * pqrs).
Thats exactly what we will do here. Basically as the problem gets solved for bigger numbers, loads of steps trickle down to maxm() function for small numbers, just like end of roots of a tree. So, here again we will pre-calculate and store maxm(n) in an array for 1<n<9400. Why 9400? Have a look at http://www.spoj.pl/problems/COINS/, you can't write more that 50KB of code! So this weekend I decide to see the real consequence of memoization. Here's the allegro code I wrote to plot time against my COIN's solution. Memoization 9400 values works for the spoj judge. And it seems even memorizing 450 values works amazingly for my Athlon 64 :P
#include <iostream>
#include <allegro.h>
#include <time.h>

using namespace std;
unsigned int a[]={0,1,2,3,4,5,6,7,8,9,10,11,13,13,14,15,17,17,19,19,21,22,23,23,27,27,27,28,30,30,32,32,35,36,36,36,41,41,41,41,44,44,46,46,48,49,49,49,57,57,57,57,57,57,60,60,63,63,63,63,68,68,68,69,74,74,76,76,76,76,76,76,87,87,87,87,87,87,87,87,92,93,93,93,98,98,98,98,101,101,104,104,104,104,104,104,119,119,119,120,120,120,120,120,120,120,120,120,129,129,129,129,134,134,134,134,134,134,134,134,144,144,144,144,144,144,147,147,155,155,155,155,160,160,160,161,161,161,161,161,161,161,161,161,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,185,193,193,197,197,197,197,197,197,207,207,207,207,207,207,207,207,212,212,212,212,221,221,221,221,221,221,221,221,221,222,222,222,250,250,250,250,250,250,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,276,276,276,276,276,276,276,276,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,304,304,304,305,305,305,305,305,305,305,305,305,314,314,314,314,327,327,327,327,327,327,327,327,337,337,337,337,337,337,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,341,391,391,391,391,391,391,391,391,391,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,392,405,405,405,405,419,419,419,419,419,419,419,419,419,419,419,419,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,439,447,447,447,447,447,447,447,447,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,469,473,473,473,473,473,473,524,524,524,524,524,524,524,524,524,524,524,524,533,533,533,533,533,533,533,533,533,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,534,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,603,641,641,641,641,641,641,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,646,668,668,668,668,668,668,668,668,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,709,709,709,709,709,709,709,709,709,709,709,709,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,723,724,724,724,724,724,724,724,724,724,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,826,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,830,851,851,851,851,851,851,851,851,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,930,943,943,943,943,943,943,943,943,943,943,943,943,943,943,943,943,994,994,994,994,994,994,994,994,994,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,1009,1009,1009,1009,1009,1009,1009,1009,1009,1009,1009,1009,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1101,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1123,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1128,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1257,1258,1258,1258,1258,1258,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1279,1350,1350,1350,1350,1350,1350,1350,1350,1350,1350,1350,1350,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1370,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1421,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1455,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1493,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1533,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1538,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1741,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1755,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1756,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1790,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1901,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1972,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,1993,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2104,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2110,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2150,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2314,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2365,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2385,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2386,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2673,2678,2678,2678,2678,2678,2678,2678,2678,2678,2678,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2712,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2842,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,2908,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3019,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3074,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3145,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3250,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3251,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3271,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3668,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3708,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3714,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,3769,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4050,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4051,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4181,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4215,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4448,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4475,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4580,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4870,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,4981,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5046,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5052,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5671,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5691,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5746,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5747,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,5982,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6179,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6412,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6501,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6631,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6887,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6894,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,6959,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7723,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7828,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7855,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7856,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,7945,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8624,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8630,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8865,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,8920,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9394,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9493,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,9749,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10258,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10491,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10681,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10682,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,10709,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12012,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12077,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12166,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12173,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,12593,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13137,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13138,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13612,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13756,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,13991,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14585,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14620,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,14810,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261,16261};
double lim = 0;

unsigned int maxm(unsigned int n){
// 9400 - size of array
if (n<lim)
return a[n];

unsigned int p;
p = n/2 + n/3 + n/4;

if (p>n)
//sort of binary recursion which you should figure out to solve COINS
else
return n;
}

int main (){
unsigned int n=10,col2,col;
double x=0,px=1,py=760,y;
clock_t start ,stop;

allegro_init();
set_color_depth(32);
set_gfx_mode (GFX_AUTODETECT_WINDOWED,1024,768,0,0);

clear_to_color (screen,makecol(0,0,0));

while (lim<450){
col = makecol ((lim/450)*250+5, (lim/450)*255, 100);
col2=makecol (((lim/450)*250+5)/3, (lim/450)*255/3, 100/3);
while (n<310){
n+=1;
start = clock();
maxm(n*20000);
stop = clock();
// cout << stop <<" "<<start << endl;
y=760-((stop-start)*5);
rectfill (screen,px,760,px+3,y,col2);
line (screen,px,py,px+3,y,col);

px+=3;
py=y;
}
lim=lim+5;
x=0; px=1; py=760;
n=10;
cout << lim<<endl;
}
getchar();
}
END_OF_MAIN();

And here's the plot! amazing visible differences...
checkout the drastic improvement from lim=0 to lim=450!
That's all for the Friday research folks!

Labels: , , , , , , , ,

Saturday, August 16, 2008

Paint Daubs effect through Allegro & C++

Went to automate some effect like this in allegro today, ended up unfinished with the paint daubs effect over bitmaps. It looks something like this -> ;)
What it basically does is draws filled circles by picking colours from original bitmap onto a copy of it. So, when many circles overlap each other they give a painting style effect. As if the image was made with short impressions of brush over and over again.
/*
Paint Daubs v.1 16 Aug 2008
An attempt at making image look like vintage art paintings.

This basic version takes a base image,
randomly creates filled circles on target image to get such effect.

Usage
------
$> paint_daubs <base.bmp> <tagert.bmp> [%blob_max] [depth] [s/c]

%blob_max is the % of size of image that a blob will size up to
depth is number of times the blobs are drawn
s/c - s for square fills, c for circles

-- Abhishek Mishra
ideamonk.blogspot.com
*/

#include <iostream>
#include <allegro.h>
using namespace std;

//Config parameters
float BASEBLOB_MAX = .02f;
float BASE_COUNT = 200.0f;


BITMAP *base, *target;
PALETTE base_pal, tar_pal;

void show_menu(char *fname){
cout << "Usage\n"
<< "------\n"
<< fname << " <base.bmp> <tagert.bmp> [%%blob_max] [depth] [s/c]\n";
}

bool init_bitmaps(char *fbase, char *ftarget){
cout << "\n[+] Loading bitmaps...\n";

// Load all three bitmaps
base = load_bitmap(fbase,base_pal);
if (!base) {
cout << " [-] Couldn't load "<<fbase <<"\n";
return false;
}

target = load_bitmap (fbase,tar_pal);
if (!target) {
cout << " [-] Couldn't create bitmap for target\n";
return false;
}

return true;
}

void process_base(char *s){
int min_dim = (base->w < base->h) ? base->w : base->h;
int bmax = (int) (BASEBLOB_MAX * min_dim);
int bmin = 2;
int times = (int) (BASE_COUNT * min_dim);
int width,color,px,py;

for (int i=0;i<times;){
width = bmin + rand() % (bmax-bmin);
px = rand() % base->w;
py = rand() % base->h;
color = getpixel(base,px,py);

if (color != makecol (255,0,255) ){
// Select fill type
if (*s=='s'){
rectfill (target,px-width/2,py-width/2,px+width/2,py+width/2, color);
} else {
circlefill(target,px,py,width/2,color);
}
i++;
}
}
}

int main (int argc, char *argv[]){
if (argc < 3){
show_menu(argv[0]);
} else {
//Allegro initialization routines
set_color_depth(32);
set_color_conversion(COLORCONV_EXPAND_HI_TO_TRUE);
allegro_init();

// Load the bitmaps
if (!init_bitmaps(argv[1],argv[2]))
return 0;

if (argc > 3)
BASEBLOB_MAX = atof(argv[3]);
if (argc > 4)
BASE_COUNT = atof(argv[4]);

cout << "[+] drwaing blobs\n";
process_base(argv[5]);

cout << "[+] saving "<< argv[2]<<"\n";
save_bitmap (argv[2],target,tar_pal);
//Debug
/*
set_gfx_mode(GFX_AUTODETECT_WINDOWED,1024,768,0,0);
blit (target,screen,0,0,0,0,800,600);
getchar();
*/
cout << "[+] done\n";

}
return 0;
}
END_OF_MAIN();

More samples (click to enlarge) =>
  • with square filter ON (s)
  • with default circlefill option and depth set to 400
To compile the source you will need Allegro working with your development environment. I use DevCPP with Allegro.devpak found at http://devpaks.org/
http://ideamonk.googlepages.com/ddl.gif
For linux & OSX, try installing Allegro and then compilling over g++ with -lalleg option.

Labels: , , ,

Sunday, August 03, 2008

Recursive fractals

Off lately recursion has become much more fascinating than ever it was to me. And the obvious catalyst in this has been computer graphics. Without visualization its impossible to appreciate the beauty of recursion, trees, sorting algorithms, etc!
Having admired the Sierpinski triangles I wondered how such an experimentation would look upon squares. And I came up with the following written in devCPP & Allegro graphics library-
#include <allegro.h>

BITMAP *work;

void draw (int x,int y,int w){
int i,j,c,r,g,b;
if (x<0 || y<0 || x>639 || y>479 || w<5)
return;

int nw=w/2;
draw(x-w/2-1,y-w/2-1,nw);
draw(x+w/2+1,y+w/2+1,nw);
draw(x-w/2-1,y+w/2+1,nw);
draw(x+w/2+1,y-w/2-1,nw);

c=w;
for (w=c;w>=1;w--){
r=((float)(sin(w)*sin(w)*c/3)/(float)c)*(float)255;
g=((float)(c-w/2)/(float)c)*(float)255;
b=((float)(w/2)/(float)c)*(float)255;
if (w<1){
r=g=b=0;
}
rect(work,x-w/2,y-w/2,x+w/2,y+w/2, makecol (r,g,b));
}
w=c;
r=((float)(c-w)/(float)c)*(float)255;
g=((float)(c-w)/(float)c)*(float)255;
b=((float)w/(float)c)*(float)255;
rect(work,x-w/2-1,y-w/2-1,x+w/2+1,y+w/2+1, makecol (r/2,g/2,b/2));
}

int main (){
allegro_init();
install_keyboard();
set_color_depth(32);
set_gfx_mode (GFX_AUTODETECT_WINDOWED,640,480,0,0);

work = create_bitmap(640,480);
clear_to_color(work,makecol(255,255,255));

draw(320,240,200);
while (!key[KEY_ESC]){
vsync();
blit (work,screen,0,0,0,0,640,480);
}

allegro_exit();
return 0;
}
END_OF_MAIN();















Some circular modifications -

#include <allegro.h>

BITMAP *work;

void draw (int x,int y,int w){
int i,j,c,r,g,b;
if (x<0 || y<0 || x>SCREEN_W || y>SCREEN_H || w<5)
return;

int nw=(float)w*(float)(.5);
draw(x-w/2-1,y-w/2-1,nw);
draw(x+w/2+1,y+w/2+1,nw);
draw(x-w/2-1,y+w/2+1,nw);
draw(x+w/2+1,y-w/2-1,nw);

c=w;
for (w=c;w>=1;w--){
r=((float)(w/2)/(float)c)*(float)255;
g=((float)(c-w/2)/(float)c)*(float)255;
b=((float)(c-w/2)/(float)c)*(float)255;
if (w<1){
r=g=b=0;
}
circlefill (work,x,y,w/2,makecol (r,g,b));
}
}

int main (){
allegro_init();
install_keyboard();
set_color_depth(32);
set_gfx_mode (GFX_AUTODETECT_WINDOWED,800,600,0,0);

work = create_bitmap(SCREEN_W,SCREEN_H);
clear_to_color(work,makecol(255,255,255));

draw(SCREEN_W/2,SCREEN_H/2,300);
while (!key[KEY_ESC]){
vsync();
blit (work,screen,0,0,0,0,SCREEN_W,SCREEN_H);
}

allegro_exit();
return 0;
}
END_OF_MAIN();































beautiful! what more can I say.

Labels: , , , ,