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  
 Pages:  1  2
Author: Subject: Challenge #1 - Falling Rock
MikeDX
DIV Nerd
*********


Avatar


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


[*] posted on 17-3-2016 at 09:13 PM


Basically using draw primitives would use a lot more code
View user's profile View All Posts By User
BreadCaster
Loyalty Card Holder
******


Avatar


Posts: 321
Registered: 2-3-2016
Member Is Offline


[*] posted on 17-3-2016 at 09:37 PM


ah, and the size of the lines of code would be more than the size of the .fpg? or does the .fpg not count :p



~*~ Princess of Pies and Pastries ~*~
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 09:42 PM


The fpg doesnt count. just the bytes of code :)
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 18-3-2016 at 08:10 PM
Score: 172 (Confirmed by Mike)


Impressive code hacks here. Technically I am stuck making it shorter so I FOUND A LOOPHOLE in the game rules!


Code:
program a; begin load_fpg("f"); p(1,1,99); // 180 can be 99 end process p(t,x,y) begin graph=t*t; // smaller way of abs repeat if(t) x=mouse.x; p(-8,x,y-9); // OMG a ship with an AUTO TURRET! XD p(6,timer%99,0); // Don't like this, one, but as per rules, rocks don't NEED to be spread out when falling end y+=t-1; // shaved off the else frame; until(collision(type p)|y>240|y<0) end




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 08:51 PM


Nicely done Dennis
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 02:48 AM
Score: 163 (but no real game)


New winner: (not really).




Code:
program a; begin load_fpg("f"); p(1,1,99); // 180 can be 99 end process p(t,x,y) begin graph=t*t; // smaller way of abs repeat if(t) x=mouse; // x is the first element of mouse, no need for .x ;) p(-8,x,y-9); // OMG a ship with an AUTO TURRET! XD p(6,x,0); // nothing in rules saying where rocks start end y+=t-1; // shaved off the else frame; until(collision(type p)|y>240|y<0) end




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




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


[*] posted on 19-3-2016 at 02:54 AM


Code:
p(6,x,0);

I actually had a constant for the x at some point, but I changed that to the timer, because it won't work since rocks will spawn over themselves and get destroyed immediately. In your case, only if you move your mouse fast enough will they actually fall down. I don't think this qualifies as a falling rocks game!

EDIT: though using x is a much better idea than a constant :kiss:
View user's profile View All Posts By User
Sandman
Loyalty Card Holder
******




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


[*] posted on 19-3-2016 at 02:59 AM
Score: 160 (but no real game)


But!

Code:
program a; begin load_fpg("f"); p(1,1,98); // 180 can be 99 end process p(t,x,y) begin graph=t*t; // smaller way of abs while(!collision(type p)&y<99&y>0) if(t) x=mouse; // x is the first element of mouse, no need for .x ;) p(-8,x,y-9); // OMG a ship with an AUTO TURRET! XD p(6,x,1); // nothing in rules saying where rocks start end y+=t-1; // shaved off the else frame; end end




Attachment: bla.zip (2kB)
This file has been downloaded 6205 times
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 03:02 AM
Score: 170


Agreed. I'll have to go for this instead



Code:
program a; begin load_fpg("f"); p(1,1,99); // 180 can be 99 end process p(t,x,y) begin graph=t*t; // smaller way of abs repeat if(t) x=mouse; // x is the first element of mouse, no need for .x ;) p(-8,x,y-9); // OMG a ship with an AUTO TURRET! XD p(6,timer%99,0); // Don't like this, one, but as per rules, rocks don't NEED to be spread out when falling end y+=t-1; // shaved off the else frame; until(collision(type p)|y>240|y<0) end




Attachment: bla.zip (2kB)
This file has been downloaded 6223 times
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 03:18 AM


Your 160 is nice. But I reckon I can keep 160 and make more of a game out of it ;)
View user's profile View All Posts By User
Sandman
Loyalty Card Holder
******




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


[*] posted on 19-3-2016 at 05:13 AM


I'll add the one without x for me as well for completeness:
Code:
program a; begin load_fpg("f"); p(1,1,98); // 180 can be 99 end process p(t,x,y) begin graph=t*t; // smaller way of abs while(!collision(type p)&y<99&y>0) if(t) x=mouse; // x is the first element of mouse, no need for .x ;) p(-8,x,y-9); // OMG a ship with an AUTO TURRET! XD p(6,timer%99,1); // nothing in rules saying where rocks start end y+=t-1; // shaved off the else frame; end end
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


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


[*] posted on 21-3-2016 at 02:50 AM
Score: 158


Utter filth, 158 chars, AND a playable game




Code:
program a; begin load_fpg("f"); p(1,1,98); // 180 can be 99 end process p(t,x,y) begin graph=t*t; // smaller way of abs while(!collision(type p)&y<99&y>0) if(t) x=mouse; // x is the first element of mouse, no need for .x ;) p(-6,x,y); // OMG a ship with an AUTO TURRET! XD p(8,x,1); // nothing in rules saying where rocks start end y+=t-1; // shaved off the else frame; end end




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




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


[*] posted on 21-3-2016 at 03:02 AM


Good offset use!

I also made improvements:
Code:
program a; begin load_fpg("f"); p(0,1,97); // 180 can be 99 end process p(t,x,y) begin graph=t+9; // smaller way of abs while(!collision(type p)&y%99) //y<99&y>0) if(t==0) x=mouse; // x is the first element of mouse, no need for .x ;) //p(-8,x,y-8); // OMG a ship with an AUTO TURRET! XD p(6,p(-8,x,y-8)%y,1); // nothing in rules saying where rocks start end y+=t; // shaved off the else frame; end end


157 chars :)

Attachment: rocks157.zip (2kB)
This file has been downloaded 6506 times

View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


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


[*] posted on 21-3-2016 at 03:51 AM


using the returned id of p() with %y is a genius faux random. very nicely done indeed!
View user's profile View All Posts By User
Sandman
Loyalty Card Holder
******




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


[*] posted on 21-3-2016 at 05:51 AM


The y-check is even more devious: all objects start at an odd y value, meaning y&99 is true, but when they reach >99 or <-99, y%99 becomes an even number.
View user's profile View All Posts By User
Sandman
Loyalty Card Holder
******




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


[*] posted on 24-3-2016 at 10:28 PM
Score: 153 (Confirmed by Mike)


OK, the final one:



Code:
program a; begin load_fpg("f"); p(9,1,97); // 180 can be 99 end process p(t,x,y) begin graph=t+9; // smaller way of abs while(collision(type p)^y%99) //y<99&y>0) if(t) x=mouse; // x is the first element of mouse, no need for .x ;) //p(-8,x,y-8); // OMG a ship with an AUTO TURRET! XD p(6,p(-8,x,y)%y,1); // nothing in rules saying where rocks start end y+=t%9; // shaved off the else frame; end end


153 chars

Attachment: rocks153.zip (2kB)
This file has been downloaded 6263 times
View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


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


[*] posted on 24-3-2016 at 10:39 PM


I think we may have a winner. Very very nicely done. and a good group effort ;)
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 11:56 AM


Kudos Sandman! Wow, I never thought the code would get this short! I already gave up under 172 chars.

I think I deserve some credit for some of the awesome graphics though.




View user's profile View All Posts By User
MikeDX
DIV Nerd
*********


Avatar


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


[*] posted on 25-3-2016 at 03:02 PM


Dennis this is definitely a group effort. Some awesome tricks in there.
View user's profile View All Posts By User
Sandman
Loyalty Card Holder
******




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


[*] posted on 25-3-2016 at 07:40 PM


Dennis, of course! Your initial idea of using only a single process type did the most, in fact.
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 1-4-2016 at 09:36 PM


Why thank you! I was just kidding about the credit though. :)



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 4-4-2016 at 05:46 AM


You forgot to copyright it to hell and back DDD:
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 5-4-2016 at 11:15 AM


Copyright it, put micro trandsactions in it, put it on Google Play Story aaaand good to go by the norm!!!1!1



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




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


[*] posted on 6-4-2016 at 10:17 PM


Get it to <150, Dennis, you can do it! Or maybe we need a new code golf challenge.
View user's profile View All Posts By User
 Pages:  1  2

  Go To Top

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