Community
Message Board

Chat room - users
Game Over
( 394431 downloads)
Work In Progress
( 523201 downloads)
Links

Code Exchange
Downloads
Tutorials
Add to Favourites

Submit news

DIV ARENA FORUMS
Not logged in [Login - Register]
Go To Bottom

Printable Version  
Author: Subject: Challenge #2 - Pixel Painter
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 05:23 PM
Challenge #2 - Pixel Painter


Create a simple paint program using the smallest code possible:

Requirements:

- visible cursor
- ability to change colours of pen
- ability to change pen size
- draw with mouse / mouse buttons (left - draw / right - erase)

whitespace (spaces, carriage returns, tabs) and comments do not count, so no need to minify your code)

you can use any graphics you like, but if you made them in the div editor, thats best ;)

Smallest code wins...

View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 05:55 PM
Putting that all inside one process is going to be totally awesome


Ability to change pen size is a requirement that's going to award you bonus points?
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 17-3-2016 at 06:07 PM


well if its a tie between two, the one with the pen size will win


also i reckon you don't even need a process...


- edit

realise what i'd done. obviously i mean to have pen size optional.
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 18-3-2016 at 03:29 AM
Score: 310


Here is my effort. Deliberately not too squashed to give you guys a chance ;)

Z - change cursor size
C - Change colour





Code:
program pixel; local a,b,c,d; s=1; begin graph=load_map("cursor.map"); loop x=mouse.x; y=mouse.y; size=s*100/3; if(mouse.left || mouse.right) for(a=0;a<s;a++) for(b=0;b<s;b++) put_pixel(x+a,y+b,c*mouse.left); end end end if (key(_z)) s=(s%10)+1; while(key(_z)) frame; end end if (key(_c)) c=(c+1)%255; while(key(_c)) frame; end end frame; end end


Can you do better? can we get it below 200?

Attachment: pixela.zip (2kB)
This file has been downloaded 3858 times
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 18-3-2016 at 10:15 AM
Ooh, I'm pretty sure I could easily double that. Derp.


Quote: Originally posted by MikeDX  
well if its a tie between two, the one with the pen size will win


also i reckon you don't even need a process...


- edit

realise what i'd done. obviously i mean to have pen size optional.

Dirty edit!

I haven't put a though on making this yet but what I ment by a process is the direction these are heading. And now it got extreme :s I'm not even remotely pissed off because Dennis uninvented DIV and shamed my 320 chars in the process. No, sir. :no:

Got a busy schedule today but should have time to have a look at this in the evening.
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 18-3-2016 at 12:40 PM
The Bestest Painting Program Ever Made v34.2a


Since you made that below 200 remark you MIGHT know how to get it below 200 but I'll still post this anyways. Pokerface.
Code:
Program a; global c,h,v,s; begin mouse.graph = load_map("m.MAP"); loop h = mouse.x; v = mouse.y; if( key(_a) ) c = h; s = v; end if( mouse.left ) draw(5, c, 9, 0, h, v, h+s, v+s); end if( mouse.right ) draw(5, 0, 9, 0, h, v, h+s, v+s); end Frame; end end

203. No bug reports please because they would be just false and ain't nobody got time for that.

edit: ooh, I just saw what you did with the mouse buttons :ninja:
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 18-3-2016 at 01:16 PM


I think this could crash with too many draws..

And you could easily get rid of loads more code ;)

also where is m.MAP?

This isn't looking good is it.. million points?
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 18-3-2016 at 03:43 PM


The draw commands are nearly identical, so perhaps there what I've already suggested, but that's all the code there is! Put your money where those filthy things come out of. Tonight. After Dennis, Sandman and a mysterious third person have destroyed me. :cries:

And what did I say about bug reports!!!!!!!!!!!!!!!!! :cries:
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 18-3-2016 at 05:33 PM


Quote: Originally posted by iWizard  
The draw commands are nearly identical, so perhaps there what I've already suggested, but that's all the code there is! Put your money where those filthy things come out of. Tonight. After Dennis, Sandman and a mysterious third person have destroyed me. :cries:

And what did I say about bug reports!!!!!!!!!!!!!!!!! :cries:


Yeah but since you failed, for multiple reasons, it is disqualified.
View user's profile View All Posts By User
iWizard
Loyalty Card Holder
******


Avatar


Posts: 159
Registered: 26-2-2016
Member Is Offline


[*] posted on 18-3-2016 at 06:56 PM


This is the worst competition like ever :love:
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


Posts: 8388607
Registered: 25-2-2016
Member Is Offline


[*] posted on 19-3-2016 at 12:44 PM
Score: 300


Better version:





Code:
program p; local c=14,d,s=5; begin load_fpg("p"); draw(5,c,9,0,x,y,x,y); loop x=mouse; y=mouse.y; d=mouse.right; if (key(_z)) s=(s%50)+4; end if (key(_c)) c=(c+1)%255; end while(key(_c)|key(_z)) frame; end put_screen(0,2); frame; move_draw(1,c*(1-d)+1,15,x,y,x+s,y+s); if(mouse.left|d) screen_copy(0,0,2,0,0,320,200); end end end


Attachment: pixel.zip (2kB)
This file has been downloaded 4257 times

View user's profile View All Posts By User
Dennis
Loyalty Card Holder
******


Avatar


Posts: 84
Registered: 26-2-2016
Location: Belgium
Member Is Offline


[*] posted on 25-3-2016 at 12:01 PM


Quote: Originally posted by iWizard  
This is the worst competition like ever :love:






(Un)fortunately I will not participate in this one... I don't think I can do better than the last entry. :P




View user's profile View All Posts By User

  Go To Top

Powered by XMB
XMB Forum Software © 2001-2012 The XMB Group
[Queries: 18]