generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Lua Code Gold 2.0 (IGNORE OTHER THREAD)

Previous Thread :: Next Thread 
thelastbunny is not online. thelastbunny
Joined: 07 Aug 2009
Total Posts: 2879
12 May 2012 08:21 PM
The object is to try to complete a task in Lua with as little characters as possible. Line breaks and other white-space characters count. You can have your code as ugly and hackish as you like.

First task:

Create a wave of an alternating character with x as the width, print the wave to the output. What the wave should look like:

Width 0:

\
/
\
/

Width 1:

\
_\
_/
/
\
_\
_/
/

Width 2:

\
_\
__\
__/
_/
/
\
_\
__\
__/
_/
/

You can have the leading character be an underscore or space. I will be the judge. Remember, as little characters as possible!
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
12 May 2012 08:23 PM
Wait, what?
Report Abuse
thelastbunny is not online. thelastbunny
Joined: 07 Aug 2009
Total Posts: 2879
12 May 2012 08:26 PM
The object is to attempt to complete a task in Lua using as little characters as possible.
Report Abuse
thelastbunny is not online. thelastbunny
Joined: 07 Aug 2009
Total Posts: 2879
12 May 2012 09:00 PM
I have (unofficially) made a working example that is exactly 100 characters long, not including declaration of 'x', I will post at the end of this contest. (Should there be a prize? I have 1,000 R$ spare...) So if it's more than 100 characters, it could use some work!
Report Abuse
LPGhatguy is not online. LPGhatguy
Forum Moderator
Joined: 27 Jun 2008
Total Posts: 4725
13 May 2012 12:59 AM
Here's an 11 line implementation:

r=string.rep
function f(x)
local o=""
for i=1,x do
o=o..r(" ",i).."\\\n"
end
for i=x,1,-1 do
o=o..r(" ",i).."/\n"
end
return o
end

Call f with any real number x.
Report Abuse
LPGhatguy is not online. LPGhatguy
Forum Moderator
Joined: 27 Jun 2008
Total Posts: 4725
13 May 2012 01:02 AM
And actually, since I didn't completely conform to the requests of the output (width 0 should return an actual wave, and it should be two 'hills' long) here's a
13 line, 147 character implementation that's fixed:

r=string.rep
function f(x)
local o=""
for _=0,1 do
for i=0,x do
o=o..r(" ",i).."\\\n"
end
for i=x,0,-1 do
o=o..r(" ",i).."/\n"
end
end
return o
end
Report Abuse
Valone is not online. Valone
Joined: 08 Feb 2012
Total Posts: 4371
13 May 2012 03:10 AM
s=string.rep
for i = 1,5 do
for i2 = 1,i do
print(s("-",i2-1).."\\")
end
for i3 = 1,i do
print(s("-",i-i3).."/")
end
end

Nothing fancy, did exactly what you said, (had to switch from spaces :/ )

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞
-Valone; Game maker; Graphical Artist and Programmer. (Female)
Report Abuse
Valone is not online. Valone
Joined: 08 Feb 2012
Total Posts: 4371
13 May 2012 03:12 AM
Oops, missed the x bit....

s=string.rep
x = 5
for i = 1,x do
for i2 = 1,i do
print(s("-",i2-1).."\\")
end
for i3 = 1,i do
print(s("-",i-i3).."/")
end
end

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞
-Valone; Game maker; Graphical Artist and Programmer. (Female)
Report Abuse
Valone is not online. Valone
Joined: 08 Feb 2012
Total Posts: 4371
13 May 2012 03:15 AM
Sorry for the triple post. Got it to 111 characters.

s=string.rep
p=print
for i=1,10 do
for v=1,i do
p(s("-",v-1).."\\")
end
for a=1,i do
p(s("-",i-a).."/")
end
end

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞
-Valone; Game maker; Graphical Artist and Programmer. (Female)
Report Abuse
LPGhatguy is not online. LPGhatguy
Forum Moderator
Joined: 27 Jun 2008
Total Posts: 4725
13 May 2012 03:17 AM
@Valone
But what about having it as a single string, and as a function?
Report Abuse
Valone is not online. Valone
Joined: 08 Feb 2012
Total Posts: 4371
13 May 2012 03:21 AM
Wasn't a rule. He just said put it in output =D
I'll give it a go though.

☜▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☜☆☞▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬☞
-Valone; Game maker; Graphical Artist and Programmer. (Female)
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
13 May 2012 03:53 AM
[ Content Deleted ]
Report Abuse
thelastbunny is not online. thelastbunny
Joined: 07 Aug 2009
Total Posts: 2879
13 May 2012 09:38 AM
It looks like Oysi is the winner, my code with 100 chars:

b=0
c={'\\','/',1,0}while 1 do
for i=0,x do
print((' '):rep(math.abs(x*b-i))..c[b+1])end
b=c[b+3]end

I can donate 1000 R$, it's all I have. Want it?
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
13 May 2012 10:06 AM
[ Content Deleted ]
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
13 May 2012 10:44 AM
Take out the returns, and replace them with a ;

Make it 3-4 characters shorter. Because Windows adds \t to it.
Report Abuse
goddessmarine12 is not online. goddessmarine12
Joined: 12 May 2012
Total Posts: 50
13 May 2012 10:54 AM
[ Content Deleted ]
Report Abuse
iCookieNL is not online. iCookieNL
Joined: 24 May 2009
Total Posts: 1103
13 May 2012 01:35 PM
dofile("C:/LuaCodeGold.lua")



owned.
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
13 May 2012 02:08 PM
How about shortest quine?
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
13 May 2012 04:39 PM
@Blue:

Source: ""
Output: ""

Done.
Report Abuse
MacGod is not online. MacGod
Joined: 16 Apr 2012
Total Posts: 114
13 May 2012 05:55 PM
*makes this script import global function from other script that does cool stuff*

_G.a()


ok i win
Report Abuse
thelastbunny is not online. thelastbunny
Joined: 07 Aug 2009
Total Posts: 2879
13 May 2012 06:20 PM
@Mac, I am testing these on Luaforwindows. No ROBLOX functions.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image