Qbasicnews.com

Full Version: Drawing AI Challenge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Challenge:
Make an AI that produces some sort of drawings/art..

Sample:
Painter.exe (N for new drawing, Esc to quit)
Thats my old painter AI, should give you an idea of what I mean..

Rules:
* Random images
* AI driven, no user input accepted (see note 2)
* No external files allowed
* No libraries allowed, only native FB/QB commands.
* QB or preferably FB allowed
* 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.
* Painting minimum size is 240x120

Best paintings win..


Ready. Set. Go!




Note: By AI, I mean that the program should work indepetently of user input.

Note 2: This only apply to input that alter the AI directly, or alter the picture in any way. Having a button to make a new painting is allowed.
See painter.exe



EDIT: Rules added!
z!re painter is awesome!

all i have lying around is this:


Download CLOUD.EXE

Anonymous

omg, that is really cool.

edit: i wanna see your source
i want to see the source as well, it looks cool (don't worry, i won't cheat. I'm on my honour and i won't press my luck, old saying. Your on your honour. Don't press your luck.).

EDIT

Technically This is AI so this should pass, i haven't run it in fb (though i ran a qb port and it ran very slow near the end)

Code:
SCREENRES 100,100
RANDOMIZE TIMER
DO
x = int((RND * 100)+ 1)
y = int((RND * 100)+ 1)
z = int((RND * 16) + 1)
IF POINT (x,y) <> 0 THEN PSET (x,y), z
LOOP WHILE INKEY$ = ""

This is the QB version i ran

Code:
DIM SHARED screenres(10000)
RANDOMIZE TIMER
SCREEN 13
DO
x = int((RND * 100)+ 1)
y = int((RND * 100)+ 1)
z = int((RND * 16) + 1)
IF screenres(x * y) = 0 THEN
PSET (x, y), z
screenres(x * y) = z
END IF
LOOP WHILE INKEY$ = ""
About the Painter source:
The program is old, very very old. And I'm not sure I still have the source, I'll look around for it.
But basically, it's a particle engine, that plots a pixel when it's blocked and cannot continue towards it's group.
A group is made up of dots with a certain color range, the dots in each group all try to move to the group center.

Quote:z!re painter is awesome!

all i have lying around is this:


Download CLOUD.EXE
Quote:* Upload the entry to FileAnchor in a zip or rar archive, containing compiled exe and source.
If you want to enter that is Big Grin


TheDarkJay, your entry is perfectly valid, except being too small. Tongue
:lol: Mine is bigger...

[syntax="FreeBasic"]' Imagination.bas: AI Drawer: by Rattrapmax6(Kevin)
' Drafts shaded lines, and inturn alows you to make out
' a wireframe structure.. e.i. I see a city scape w/ buildings
' and streets after awhile.. ^_^

'Clicking window's X closes while drawing
' N = New pic after Pic is done
' ESC & Window X = Exit after pic is finished
' Enjoy!!

SCREEN 18, 32

DECLARE SUB rnd_motion
DO: CLS
DIM SHARED MinX = 10, MaxX = 260
DIM SHARED MinY = 10, MaxY = 140
DIM SHARED x, y, area, xv, yv
RANDOMIZE TIMER
cont = 0
MinX = 10: MaxX = 500
MinY = 10: MaxY = 400
area = 191100: x = 10: y = 10
xv = 1: yv = 1
DO
IF INKEY$ = CHR$(255) + "X" THEN END

rndcol = INT(RND * 255) + 1
rnd_motion
lineL = INT(RND * 20) + 1
FOR i = 1 TO LineL
cont = cont + 1
IF y < MinY THEN yv = 1
IF y > MaxY THEN yv = -1
IF x < MinX THEN xv = 1
IF x > MaxX THEN xv = -1
x = x + xv
y = y + yv
PSET (x, y), RGB(0, rndcol, rndcol)
NEXT
T! = TIMER
DO: LOOP UNTIL (TIMER - T!) >= .005
LOCATE 28, 1: PRINT INT((cont / area) * 100); "%"
LOOP UNTIL cont >= area
DO

press$ = INKEY$
IF press$ = CHR$(27) THEN END
IF press$ = CHR$(255) + "X" THEN END
IF UCASE$(press$) = "N" THEN EXIT DO
LOOP
LOOP

SUB rnd_motion
'How many motions:
M = INT(RND * 3) + 1
'Up down
IF M = 1 THEN
R1 = INT(RND * 2) + 1
IF R1 = 1 THEN yv = -1
IF R1 = 2 THEN yv = 1
'Left right
R2 = INT(RND * 2) + 1
IF R2 = 1 THEN xv = -1
IF R2 = 2 THEN xv = 1
ELSEIF M = 2 THEN
'Up down
IF M = 1 THEN
R1 = INT(RND * 2) + 1
IF R1 = 1 THEN yv = -1
IF R1 = 2 THEN yv = 1
xv = 0
ELSEIF M = 3 THEN
'Left right
R2 = INT(RND * 2) + 1
IF R2 = 1 THEN xv = -1
IF R2 = 2 THEN xv = 1
yv = 0
END IF
END IF
END SUB [/syntax]
Nice rat, but it gets boring pretty quick..

And it's always "the same" drawing
isn't size something most challenges want you to reduce, lol. The smaller the better.
Its ment to be Random... heh.. :roll:

Well,. If I can enter twice:

[syntax="FreeBasic"]' Wild Painter: By Rattrapmax6(Kevin)

'Painting:
'Window X (click) = END

'Not Painting:
'Window X (Click) = END
'ESC = END
'N = New Picture

'Enjoy!!

SCREEN 14, 32

RANDOMIZE TIMER

MxX = 300: MxY = 200
MnX = 10: MnY = 10
Area = 1000

DO: CLS
cont = 0
X = 10
Y = 10
DO
press$ = INKEY$
'Select tool
T = INT(RND * 3) + 1
IF T = 1 THEN 'Line
M = INT(RND * 2) + 1
IF M = 1 THEN YV = 1
IF M = 2 THEN YV = -1
M = INT(RND * 2) + 1
IF M = 1 THEN XV = 1
IF M = 2 THEN XV = -1
SX = INT(RND * (300 - 10 + 1) + 10)
SY = INT(RND * (300 - 10 + 1) + 10)
LoopL = INT(RND * 30) + 1
FOR i = 1 TO LoopL
cont = cont + 1
RD = INT(RND * 255) + 1
GR = INT(RND * 255) + 1
BL = INT(RND * 255) + 1
IF X > MxX THEN XV = -1
IF X < MnX THEN XV = 1
IF Y > MxY THEN YV = -1
IF Y < MnY THEN YV = 1
X = X + XV
Y = Y + YV
LINE (SX, SY)-(X, Y), RGB(RD,GR,BL)
SLEEP 100
NEXT

ELSEIF T = 2 THEN 'Circle
NC = INT(RND * 30) + 1
FL = INT(RND * 2) + 1
FOR i = 1 TO NC
cont = cont + 1
RD = INT(RND * 255) + 1
GR = INT(RND * 255) + 1
BL = INT(RND * 255) + 1
SX = INT(RND * (300 - 10 + 1) + 10)
SY = INT(RND * (300 - 10 + 1) + 10)
R = INT(RND * 20) + 1
CIRCLE (SX, SY), R, RGB(RD,GR,BL)
IF FL = 2 THEN PAINT (SX, SY), RGB(RD,GR,BL)
SLEEP 100
NEXT

ELSEIF T = 3 THEN 'Pixel
NP = INT(RND * 30) + 1
FOR i = 1 TO NC
cont = cont + 1
RD = INT(RND * 255) + 1
GR = INT(RND * 255) + 1
BL = INT(RND * 255) + 1
SX = INT(RND * (300 - 10 + 1) + 10)
SY = INT(RND * (300 - 10 + 1) + 10)
PSET (SX, SY), RGB(RD,GR,BL)
SLEEP 100
NEXT
END IF

IF X > MxX THEN XV = -1
IF X < MnX THEN XV = 1
IF Y > MxY THEN YV = -1
IF Y < MnY THEN YV = 1
X = X + XV
Y = Y + YV
IF press$ = CHR$(255) + "X" THEN END
LOCATE 1, 1: PRINT INT((cont / area) * 100); "%"
LOOP UNTIL Cont >= Area

DO
press$ = INKEY$
IF press$ = CHR$(27) THEN END
IF press$ = CHR$(255) + "X" THEN END
IF UCASE$(press$) = "N" THEN EXIT DO
LOOP
LOOP


[/syntax]
Code:
SCREENRES 100,100
RANDOMIZE TIMER
DO
x = int((RND * 100)+ 1)
y = int((RND * 100)+ 1)
z = int((RND * 16) + 1)
IF POINT (x,y) = 0 THEN PSET (x,y), z
LOOP WHILE INKEY$ = ""

Just spotted a problem in my code, i did <> instead of = (i was trying a black and white one originally and stopped half way and changed to colour. This was a reminent of then
Pages: 1 2 3 4