Qbasicnews.com
July 02, 2020, 06:10:06 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2] 3
  Print  
Author Topic: Drawing AI Challenge  (Read 22395 times)
Z!re
*/-\*
*****
Posts: 4599


« Reply #15 on: August 08, 2005, 04:56:15 PM »

@JasonSG: I couldnt run your code, it fails on this line:
DIM SHARED Picture(SW, SH)
With a subscript out of range..
What are you using to run it?


@Pyrodap, nice, but doesent follow the rules:
* Upload the entry to FileAnchor in a zip or rar archive, containing compiled exe and source.
* Drawing must stop by itself, and will only be judged then.

Still cool though =)
Logged
JasonSG
New Member

Posts: 20


« Reply #16 on: August 08, 2005, 10:28:05 PM »

I'm using QB 7.1 PDS with the /Ah command line option.
Logged
Anonymous
Guest
« Reply #17 on: August 09, 2005, 03:32:14 AM »

aff z!re, post souce b4 u demand it from others =(
Logged
JasonSG
New Member

Posts: 20


« Reply #18 on: August 10, 2005, 12:10:47 AM »

I modifyied my program to make it more like painter.  I still have a few problems.  The main ones are that not all the pixels move around the outside to try to find an alternate route correctly; occassionaly getting "stuck", and that there are almost always black spots that leave me with unfinished paintings.  I also found two minor ones: if you press and hold down the "n" key, it gives me an out of stack space error (in z!ire's painer, it dosen't) (possibly caused by the way I am trapping the keys - ON KEY(n) GOSUB), the fact that sometimes, it runs very slowly (this is fixed by restarting qbasic).  Here is my updated code:
Code:
DECLARE FUNCTION Math.Rand! (lowerbound!, upperbound!)
DECLARE FUNCTION RAND! ()
DECLARE FUNCTION MIN! (num1!, num2!)
DECLARE SUB PlotPxl (Pxl!)
DECLARE SUB RegenPxl ()
DECLARE FUNCTION Center! (Group!)
DECLARE SUB CreateGroups ()
OPTION BASE 1
'Declare constants for easy edit-ability.  The names are as follows:
'SNum        - SCREEN number
'SWidth      - SCREEN Width
'SHeight     - SCREEN Height
'SLColor     - The lower limit of the colors
'SUColor     - The upper limit of the colors
'Groups      - The number of ranges of pixels you want
'SBorder     - The width of the pixel border
'LPalette    - The lower limit of the palettes (set to 0 if not using palettes)
'UPalette    - The upper limit of the palettes (set to 0 if not using palettes)
'NotUsed     - The middle number of the group of colors not used
'CustGroups  - -1 only if you will define your own color groups
'SpaceGroups - The number of blank pixels between each group
'Pxls        - The number of pixels you want to have per group.
CONST SNum = 13
CONST SWidth = 320, SHeight = 200
CONST SLColor = 0, SUColor = 55
CONST Groups = 7
CONST SBorder = 10
CONST LPalette = 0, UPalette = 0
CONST NotUsed = 0
CONST CustGroups = -1, SpaceGroups = 0
CONST Pxls = 10
COMMON SHARED ColorGroups()
CG = Groups
CS = INT((SUColor - SLColor + 1) / Groups - SpaceGroups)
DIM SHARED ColorGroups(CG, CS)
DIM SHARED PxlEngine(Pxls * Groups, 6)
SW = SWidth
SH = SHeight
SCREEN SNum
KEY 15, CHR$(0) + CHR$(49)
KEY 16, CHR$(0) + CHR$(1)
ON KEY(15) GOSUB beginner
ON KEY(16) GOSUB leaver
KEY(15) ON
KEY(16) ON
ERASE PxlEngine, ColorGroups
REDIM SHARED PxlEngine(Pxls * Groups, 6)
REDIM SHARED ColorGroups(CG, CS)
IF CustGroups THEN
'================Edit this if you are making custom groups==============
        FOR y = 1 TO Groups
                FOR x = 1 TO (1 + SUColor - SLColor) / Groups
                        READ colors
                        ColorGroups(y, x) = colors
                NEXT x
        NEXT y
        'DATA 4,128,6,7,8,100,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,162,161,160,64,97,65,99
        'DATA 96,98,129,130,131,132,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63
        'DATA 192,2,193,194,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95
        'DATA 104,1,32,33,9,3,124,125,126,127,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,101,102,103
        'DATA 5,34,35,36,37,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159
        'DATA 31,30,29,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191
        'DATA 66,66,67,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223
        'DATA 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255

        'DATA 1,181,205,106,130,31,55,9
        'DATA 2,182,206,107,131,32,56,10
        'DATA 3,183,207,108,132,33,57,11
        'DATA 4,184,208,109,133,34,58,12
        'DATA 5,185,209,110,134,35,59,13
        'DATA 6,186,210,111,135,36,60,14
        'DATA 7,187,211,112,136,37,61,15
        'DATA 8,188,212,113,137,38,62,16

        DATA 1,1,1,1,1,1,1,1
        DATA 2,2,2,2,2,2,2,2
        DATA 3,3,3,3,3,3,3,3
        DATA 4,4,4,4,4,4,4,4
        DATA 5,5,5,5,5,5,5,5
        DATA 6,6,6,6,6,6,6,6
        DATA 7,7,7,7,7,7,7,7
        DATA 8,8,8,8,8,8,8,8


'========================================================================
ELSE
        CALL CreateGroups
END IF
RESET
ERASE PxlEngine
REDIM SHARED PxlEngine(Pxls * Groups, 6)
Quad(1) = INT((SWidth - 2 * SBorder) / INT(SQR(Groups) + .5) + .5)
Quad(2) = INT((SHeight - 2 * SBorder) / INT(Groups / INT(SQR(Groups) + .5) + .5) + .5)
DIM GQuad(Groups, 2)
FOR i = 1 TO Groups
        DO
                working = -1
                GQuad(i, 1) = Math.Rand(1, INT(SQR(Groups) + .5))
                GQuad(i, 2) = Math.Rand(1, INT(Groups / INT(SQR(Groups) + .5) + .9))
                FOR N = 1 TO i - 1
                        IF GQuad(N, 1) = GQuad(i, 1) AND GQuad(i, 2) = GQuad(N, 2) THEN
                                working = 0
                                EXIT FOR
                        END IF
                NEXT N
        LOOP UNTIL working
NEXT i
FOR i = 1 TO Pxls * Groups
        PxlEngine(i, 3) = INT((i - 1) / Pxls + 1) 'group
        PxlEngine(i, 4) = Math.Rand(SLColor + 1, INT(SUColor / Groups)) 'color
        PxlEngine(i, 5) = Math.Rand(1, 3)'rate of change for color
        PxlEngine(i, 6) = -1 'alive (-1) or dead (0)
        DO
                works = -1
                PxlEngine(i, 1) = Math.Rand(GQuad(PxlEngine(i, 3), 1) * Quad(1) - Quad(1) + SBorder, GQuad(PxlEngine(i, 3), 1) * Quad(1) + SBorder)'x
                PxlEngine(i, 2) = Math.Rand(GQuad(PxlEngine(i, 3), 2) * Quad(2) - Quad(2) + SBorder, GQuad(PxlEngine(i, 3), 2) * Quad(2) + SBorder)'y
                'IF -INT(RAND + .5) THEN
                        'coord = INT((SWidth - SBorder - SBorder + 1) * RAND + SBorder)
                        'PxlEngine(i, 1) = coord
                        'PxlEngine(i, 2) = SBorder + INT(RAND + .5) * (SHeight - 2 * SBorder + 1)
                'ELSE
                        'coord = INT((SHeight - SBorder - SBorder + 1) * RAND + SBorder)
                        'PxlEngine(i, 2) = coord
                        'PxlEngine(i, 1) = SBorder + INT(RAND + .5) * (SWidth - 2 * SBorder + 1)
                'END IF
                FOR a = 1 TO i - 1
                        IF PxlEngine(a, 1) = PxlEngine(i, 1) AND PxlEngine(a, 2) = PxlEngine(i, 2) THEN
                                works = 0
                                EXIT FOR
                        END IF
                NEXT a
        LOOP UNTIL works
NEXT i
begin:
KEY(15) ON
KEY(16) ON
CLS
FOR i = 1 TO Pxls * Groups
        LINE (PxlEngine(i, 1), PxlEngine(i, 2))-(PxlEngine(i, 1), PxlEngine(i, 2)), ColorGroups(PxlEngine(i, 3), PxlEngine(i, 4))
NEXT i
DO
        RANDOMIZE TIMER * RAND
        done = -1
        FOR x = SBorder TO SWidth - SBorder
                FOR y = SBorder TO SHeight - SBorder
                        IF POINT(x, y) = 0 THEN
                                done = 0
                                EXIT FOR
                        END IF
                NEXT y
                IF done = 0 THEN EXIT FOR
        NEXT x
        FOR i = 1 TO Pxls * Groups
                CALL PlotPxl(i)
                'PxlEngine(i, 1) = PxlEngine(i - 1, 1) AND PxlEngine(i, 2) = PxlEngine(i - 1, 2)
        NEXT i
        CALL RegenPxl
        'PLAY "L64 N0"
LOOP UNTIL done
ik$ = ""
WHILE ik$ <> "n" AND ik$ <> CHR$(0) + CHR$(1)
        ik$ = LCASE$(INKEY$)
WEND
END
beginner: RETURN begin
leaver: END

FUNCTION Center (Group)
        total = 0
        SumX = 0
        SumY = 0
        FOR i = 1 TO Pxls * Groups
                IF PxlEngine(i, 3) = Group THEN
                        SumX = SumX + PxlEngine(i, 1)
                        SumY = SumY + PxlEngine(i, 2)
                        total = total + 1
                ELSEIF total <> 0 THEN
                        EXIT FOR
                END IF
        NEXT i
        Center = INT(SumX / (total - (total = 0))) + INT(SumY / (total - (total = 0))) / 1000
END FUNCTION

SUB CreateGroups
        FOR i = 1 TO Groups
                counter = 1
                FOR c = (i - 1) * INT((SUColor - SLColor + 1) / Groups) TO i * INT((SUColor - SLColor + 1) / Groups - SpaceGroups)
                        ColorGroups(i, counter) = c
                        counter = counter + 1
                NEXT c
        NEXT i
END SUB

FUNCTION Math.Rand (lowerbound, upperbound)
        'RANDOMIZE TIMER
        Math.Rand = INT((upperbound - lowerbound + 1) * RND + lowerbound)
END FUNCTION

FUNCTION MIN (num1, num2)
        IF num1 < num2 THEN MIN = num1 ELSE MIN = num2
END FUNCTION

SUB PlotPxl (Pxl)
        GCenter = Center(PxlEngine(Pxl, 3))
        GCenterX = INT(GCenter)
        GCenterY = INT(1000 * (GCenter - INT(GCenter)))
        IF GCenterX = PxlEngine(Pxl, 1) AND GCenterY = PxlEngine(Pxl, 2) AND PxlEngine(Pxl, 1) > SBorder AND PxlEngine(Pxl, 1) < SWidth - SBorder AND PxlEngine(Pxl, 2) > SBorder AND PxlEngine(Pxl, 2) < SHeight - SBorder THEN
                s = INT(RAND + .5) * 2 - 1
                e = -s
                st = (e - s) / ABS(e - s)
                FOR x = s TO e STEP st
                        s2 = INT(RAND + .5) * 2 - 1
                        e2 = -s2
                        st2 = (e2 - s2) / ABS(e2 - s2)
                        FOR y = s2 TO e2 STEP st2
                                IF POINT(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)) = 0 THEN
                                        PxlEngine(Pxl, 1) = PxlEngine(Pxl, 1) + x
                                        PxlEngine(Pxl, 2) = PxlEngine(Pxl, 2) + y
                                        PxlEngine(Pxl, 4) = PxlEngine(Pxl, 4) + PxlEngine(Pxl, 5)
                                        IF PxlEngine(Pxl, 4) < 1 THEN
                                                PxlEngine(Pxl, 4) = 1
                                                PxlEngine(Pxl, 5) = INT((3 - 1 + 1) * RAND + 1)
                                        ELSEIF PxlEngine(Pxl, 4) > INT((SUColor - SLColor + 1) / Groups - SpaceGroups) THEN
                                                PxlEngine(Pxl, 4) = INT((SUColor - SLColor + 1) / Groups - SpaceGroups)
                                                PxlEngine(Pxl, 5) = -INT((3 - 1 + 1) * RAND + 1)
                                        END IF
                                        LINE (PxlEngine(Pxl, 1), PxlEngine(Pxl, 2))-(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)), ColorGroups(PxlEngine(Pxl, 3), PxlEngine(Pxl, 4))
                                        EXIT SUB
                                END IF
                        NEXT y
                NEXT x
                PxlEngine(Pxl, 6) = 0
                EXIT SUB
        END IF
        works = -1
        TryX = PxlEngine(Pxl, 1) - (PxlEngine(Pxl, 1) - GCenterX) / ABS(PxlEngine(Pxl, 1) - GCenterX - ((PxlEngine(Pxl, 1) - GCenterX) = 0))
        TryY = PxlEngine(Pxl, 2) - (PxlEngine(Pxl, 2) - GCenterY) / ABS(PxlEngine(Pxl, 2) - GCenterY - ((PxlEngine(Pxl, 2) - GCenterY) = 0))
        IF POINT(TryX, TryY) <> 0 THEN
                TryX = PxlEngine(Pxl, 1)
                TryY = PxlEngine(Pxl, 2)
                IF TryX = SWidth - SBorder OR TryX = SBorder OR TryY = SBorder OR TryY = SHeight - SBorder THEN
                        FOR TX = -1 TO 1
                                IF TX = 0 THEN TX = 1
                                FOR TY = -1 TO 1
                                        IF TY = 0 THEN TY = 1
                                        works = -1
                                                IF TryX + TX < SWidth - SBorder AND TryX + TX > SBorder AND TryY + TY > SBorder AND TryY + TY < SHeight - SBorder THEN
                                                IF POINT(TryX + TX, TryY + TY) <> 0 THEN
                                                        works = 0
                                                END IF
                                                IF works THEN
                                                        TryX = TryX + TX
                                                        TryY = TryY + TY
                                                        EXIT FOR
                                                END IF
                                        ELSE
                                                works = 0
                                        END IF
                                NEXT TY
                                IF works THEN EXIT FOR
                        NEXT TX
                        IF NOT works THEN
                                IF TryX < SWidth / 2 THEN TrY = 1 ELSE TrY = -1
                                IF TryY < SHeight / 2 THEN TrX = -1 ELSE TrX = 1
                                FOR TX = 0 TO TrX STEP TrX
                                        FOR TY = 0 TO TrY STEP TrY
                                                IF ABS(TX) <> ABS(TY) THEN
                                                        IF (POINT(TryX + TX, TryY + TY) = 0 OR POINT(TryX + TX, TryY + TY) = -1) AND TryX + TX < SWidth - SBorder + 1 AND TryX + TX > SBorder - 1 AND TryY + TY > SBorder - 1 AND TryY + TY < SHeight -  _
SBorder + 1 THEN
                                                                'IF TryX + TX > 9 AND TryY + TY > 9 AND POINT(TryX + TX, TryY + TY) = 0 AND (TX <> 0 OR TY <> 0) THEN
                                                                LINE (PxlEngine(Pxl, 1), PxlEngine(Pxl, 2))-(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)), 0
                                                                PxlEngine(Pxl, 1) = PxlEngine(Pxl, 1) + TX
                                                                PxlEngine(Pxl, 2) = PxlEngine(Pxl, 2) + TY
                                                                PxlEngine(Pxl, 4) = PxlEngine(Pxl, 4) + PxlEngine(Pxl, 5)
                                                                IF PxlEngine(Pxl, 4) < 1 THEN
                                                                        PxlEngine(Pxl, 4) = 1
                                                                        PxlEngine(Pxl, 5) = INT((3 - 1 + 1) * RAND + 1)
                                                                ELSEIF PxlEngine(Pxl, 4) > INT((SUColor - SLColor + 1) / Groups - SpaceGroups) THEN
                                                                        PxlEngine(Pxl, 4) = INT((SUColor - SLColor + 1) / Groups - SpaceGroups)
                                                                        PxlEngine(Pxl, 5) = -INT((3 - 1 + 1) * RAND + 1)
                                                                END IF
                                                                LINE (PxlEngine(Pxl, 1), PxlEngine(Pxl, 2))-(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)), ColorGroups(PxlEngine(Pxl, 3), PxlEngine(Pxl, 4))
                                                                EXIT SUB
                                                        END IF
                                                END IF
                                        NEXT TY
                                NEXT TX
                                PxlEngine(Pxl, 4) = PxlEngine(Pxl, 4) + PxlEngine(Pxl, 5)
                                IF PxlEngine(Pxl, 4) < 1 THEN
                                        PxlEngine(Pxl, 4) = 1
                                        PxlEngine(Pxl, 5) = INT((3 - 1 + 1) * RAND + 1)
                                ELSEIF PxlEngine(Pxl, 4) > INT((SUColor - SLColor + 1) / Groups - SpaceGroups) THEN
                                        PxlEngine(Pxl, 4) = INT((SUColor - SLColor + 1) / Groups - SpaceGroups)
                                        PxlEngine(Pxl, 5) = -INT((3 - 1 + 1) * RAND + 1)
                                END IF



                                LINE (PxlEngine(Pxl, 1), PxlEngine(Pxl, 2))-(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)), 0
                                PxlEngine(Pxl, 6) = 0



                                EXIT SUB
                        END IF
                ELSE
                        s = INT(RAND + .5) * 2 - 1
                        e = -s
                        st = (e - s) / ABS(e - s)
                        FOR TX = s TO e STEP st
                                s2 = INT(RAND + .5) * 2 - 1
                                e2 = -s2
                                st2 = (e2 - s2) / ABS(e2 - s2)
                                FOR TY = s2 TO e2 STEP st2
                                        works = -1
                                        IF TryX + TX < SWidth - SBorder AND TryX + TX > SBorder AND TryY + TY > SBorder AND TryY + TY < SHeight - SBorder THEN
                                                IF POINT(TryX + TX, TryY + TY) <> 0 THEN
                                                        works = 0
                                                END IF
                                                IF works THEN
                                                        TryX = TryX + TX
                                                        TryY = TryY + TY
                                                        EXIT FOR
                                                END IF
                                        ELSE
                                                works = 0
                                        END IF
                                NEXT TY
                                IF works THEN EXIT FOR
                        NEXT TX
                END IF
        ELSE
                LINE (PxlEngine(Pxl, 1), PxlEngine(Pxl, 2))-(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)), 0
        END IF
        IF NOT works AND PxlEngine(Pxl, 1) > SBorder AND PxlEngine(Pxl, 1) < SWidth - SBorder AND PxlEngine(Pxl, 2) > SBorder AND PxlEngine(Pxl, 2) < SHeight - SBorder THEN
                make = -1
        ELSE
                make = 0
        END IF
        IF make THEN
                PxlEngine(Pxl, 6) = 0
                EXIT SUB
        ELSEIF NOT works THEN
                LINE (PxlEngine(Pxl, 1), PxlEngine(Pxl, 2))-(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)), 0
                PxlEngine(Pxl, 6) = 0
                EXIT SUB
        END IF
        PxlEngine(Pxl, 1) = TryX
        PxlEngine(Pxl, 2) = TryY
        PxlEngine(Pxl, 4) = PxlEngine(Pxl, 4) + PxlEngine(Pxl, 5)
        IF PxlEngine(Pxl, 4) < 1 THEN
                PxlEngine(Pxl, 4) = 1
                PxlEngine(Pxl, 5) = INT((3 - 1 + 1) * RAND + 1)
        ELSEIF PxlEngine(Pxl, 4) > INT((SUColor - SLColor + 1) / Groups - SpaceGroups) THEN
                PxlEngine(Pxl, 4) = INT((SUColor - SLColor + 1) / Groups - SpaceGroups)
                PxlEngine(Pxl, 5) = -INT((3 - 1 + 1) * RAND + 1)
        END IF
        LINE (PxlEngine(Pxl, 1), PxlEngine(Pxl, 2))-(PxlEngine(Pxl, 1), PxlEngine(Pxl, 2)), ColorGroups(PxlEngine(Pxl, 3), PxlEngine(Pxl, 4))
END SUB

FUNCTION RAND
        'RANDOMIZE TIMER
        RAND = RND
END FUNCTION

SUB RegenPxl
        FOR i = 1 TO Pxls * Groups
                IF NOT PxlEngine(i, 6) THEN
                        TY = SHeight - SBorder - PxlEngine(i, 2)
                        RX = SWidth - SBorder - PxlEngine(i, 1)
                        LX = PxlEngine(i, 1) - SBorder
                        BY = PxlEngine(i, 2) - SBorder
                        MX = MIN(RX, LX)
                        MY = MIN(TY, BY)
                        IF MX < MY OR -INT(RAND + RAND / 2) THEN
                        'IF -INT(RAND + .5) THEN
                                PxlEngine(i, 1) = SWidth - SBorder
                                IF MX = LX OR -INT(RAND + RAND / 2) THEN PxlEngine(i, 1) = SBorder
                                'IF -INT(RAND + .5) THEN PxlEngine(i, 1) = SBorder
                        ELSE
                                PxlEngine(i, 2) = SHeight - SBorder
                                IF MY = BY OR -INT(RAND + RAND / 2) THEN PxlEngine(i, 2) = SBorder
                                'IF -INT(RAND + .5) THEN PxlEngine(i, 2) = SBorder
                        END IF
                        IF POINT(PxlEngine(i, 1), PxlEngine(i, 2)) <> 0 THEN
                                DO
                                        works = -1
                                        IF -INT(RAND + .5) THEN
                                                coord = INT((SWidth - SBorder - SBorder + 1) * RAND + SBorder)
                                                PxlEngine(i, 1) = coord
                                                PxlEngine(i, 2) = SBorder + INT(RAND + .5) * (SHeight - 2 * SBorder + 1)
                                        ELSE
                                                coord = INT((SHeight - SBorder - SBorder + 1) * RAND + SBorder)
                                                PxlEngine(i, 2) = coord
                                                PxlEngine(i, 1) = SBorder + INT(RAND + .5) * (SWidth - 2 * SBorder + 1)
                                        END IF
                                        IF POINT(PxlEngine(i, 1), PxlEngine(i, 2)) <> 0 THEN works = 0
                                LOOP UNTIL works
                        END IF
                        PxlEngine(i, 4) = INT(INT((SUColor - SLColor + 1) / Groups - SpaceGroups) * RAND + 1) 'color
                        PxlEngine(i, 5) = INT((3 - 1 + 1) * RAND + 1) 'rate of change for color
                        PxlEngine(i, 6) = -1 'alive (-1) or dead (0)
                        LINE (PxlEngine(i, 1), PxlEngine(i, 2))-(PxlEngine(i, 1), PxlEngine(i, 2)), ColorGroups(PxlEngine(i, 3), PxlEngine(i, 4))
                END IF
        NEXT i
        'PxlEngine(i, 1) = PxlEngine(i - 1, 1) AND PxlEngine(i, 2) = PxlEngine(i - 1, 2)
END SUB


If you want more random pictures, make Pxls be random and regenerated each time you hit "n".
Logged
Dio
I hold this place together
*****
Posts: 874



« Reply #19 on: August 10, 2005, 03:53:31 AM »

holy crap! this whole time i didn't know that with z!re's program if you press 'n' you get a new drawing.  :-?
Logged

quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Z!re
*/-\*
*****
Posts: 4599


« Reply #20 on: August 10, 2005, 04:40:32 PM »

Quote from: "Cha0s"
aff z!re, post souce b4 u demand it from others =(
I never demanded anything, I just figured it would be a nice change from Moneos date/converter/etc challenges.


JasonSG, I still cant run your code, could you compile and upload it?
www.fileanchor.com
Logged
JasonSG
New Member

Posts: 20


« Reply #21 on: August 10, 2005, 06:55:25 PM »

Here it is: Download Painter2.zip
It contains 2 versions - one with a constant number of pixels per group (painter2) and one with a random number (painter3).  I am still having trouble getting the pixels to move around the sides.  I am also having trouble getting the pixels not to leave black spaces.  I currently have each group be a single color, not a range of colors.  This can be changed by changing the DATA statements.
Logged
rdc
Senior Member
**
Posts: 176



WWW
« Reply #22 on: August 12, 2005, 12:48:49 PM »

Here is my little painter:

Download rdcpaint.zip
Logged

rdc
Senior Member
**
Posts: 176



WWW
« Reply #23 on: August 12, 2005, 01:24:32 PM »

I added a mutation factor so that it generates a little different pattern:

Download rdcpaint2.zip

I goofed and kept the same file names, so copy this into a different folder.
Logged

Z!re
*/-\*
*****
Posts: 4599


« Reply #24 on: August 12, 2005, 03:23:10 PM »

JasonSG, it's nice, but as it tries to mimic Painter, you cant help but compare.
The colors in your version doesent flow together as nice.. the black spots doesent look weird though, they actually fit.

rdc, I like both your entries.
Although, to be very nitpicky, your first one never stops, but I dont care, it's still nice.
The second is a little boring compared to the first, as there's so much black.


I was thinking of letting the competition run until the 15th, and announce the winner in QB Express, if Pete accepts the small article/thingy..

Sounds good to you people?


My painter.exe is not an entry, it's just an example, it doesent follow the rules of source..



Anywas, more entries people!
Logged
rdc
Senior Member
**
Posts: 176



WWW
« Reply #25 on: August 12, 2005, 05:34:41 PM »

Just so I am keeping with the rules, here is a fixed version of my first painter that stops when the screen is full (watch the title bar), and my official entry. Discard the others please.

Download rdcpainta.zip

Edit:

I noticed a little bug with the IsFull function. I forgot to exit the outer loop. Replace IsFull with the following code and it should run a bit faster.

Code:

'checks to see if screen is full
Function IsFull() As Integer
    Dim As Integer i, j
    Dim As Integer cnt
    Dim ret As Integer = True
   
    For i = 0 To sw - 1
        For j = 0 To sh - 1
            If bscreen(i, j) = 0 Then
                ret = False
                Exit For
            End If
        Next
        If ret = False Then
            Exit For
        End If
    Next
    Return ret
End Function
Logged

Dio
I hold this place together
*****
Posts: 874



« Reply #26 on: August 12, 2005, 06:30:34 PM »

rdc, is that FB? i mean the whole thing.
Logged

quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
rdc
Senior Member
**
Posts: 176



WWW
« Reply #27 on: August 12, 2005, 06:31:57 PM »

Quote from: "Dio"
rdc, is that FB? i mean the whole thing.


Yes, it is FB .14. Sorry, I should have mentioned that.
Logged

Dio
I hold this place together
*****
Posts: 874



« Reply #28 on: August 12, 2005, 07:20:22 PM »

the big tip-off was when i saw the mouse. and that it wouldn't run in qb. and other stuff...hmm...
Logged

quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Z!re
*/-\*
*****
Posts: 4599


« Reply #29 on: August 15, 2005, 10:19:37 PM »

Winner:
rdc

For the most interessting, and pleasing to look at paintings.


I don't have time to whip up a trophy or submit to QB Express, hope you can forgive me Sad


EDIT: Ok, I found some time, submitted to QB Express
Logged
Pages: 1 [2] 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!