MikeDX
|
|
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...
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
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?
|
|
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.
|
|
MikeDX
|
|
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 3857 times
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
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.
Got a busy schedule today but should have time to have a look at this in the evening.
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
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
|
|
MikeDX
|
|
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?
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
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:
|
|
MikeDX
|
|
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.
|
|
iWizard
Loyalty Card Holder
Posts: 159
Registered: 26-2-2016
Member Is Offline
|
|
This is the worst competition like ever
|
|
MikeDX
|
|
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 4256 times
|
|
Dennis
Loyalty Card Holder
Posts: 84
Registered: 26-2-2016
Location: Belgium
Member Is Offline
|
|
(Un)fortunately I will not participate in this one... I don't think I can do better than the last entry. :P
|
|