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: Scripting Challenge

Previous Thread :: Next Thread 
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
13 Apr 2016 11:26 PM
local Letters = {"F","B","C","G","I","M","Z","V","R"}
local Numbers = {0,1,2,3,4,5,6,7,8,9}


Task: Given the tables above create a random code generator that is 7 characters long...

Rules:
-Shortest Length Wins
-Efficiency


Winner will receive a special prize!
Report Abuse
Repotted is not online. Repotted
Joined: 26 Nov 2011
Total Posts: 4990
13 Apr 2016 11:55 PM
local characters = {"F","B","C","G","I","M","Z","V","R","0","1","2","3","4","5","6","7","8","9"}
local string = ""
for i = 1, 7 do
string = string .. characters[math.random(1,#characters)]
end



Report Abuse
BossfightX is not online. BossfightX
Joined: 06 Feb 2010
Total Posts: 2962
14 Apr 2016 12:04 AM
Let's say it's not 100% efficient, but if I were to code this in C# I would making a super efficient script

local Letters = {"F","B","C","G","I","M","Z","V","R"}
local Numbers = {0,1,2,3,4,5,6,7,8,9}
local code = "";
local r = 0;

for i = 1,7 do
r = math.random(1,2);
if r == 1 then
code = code.. Letters[math.random(0,#Letters)];
elseif r == 2 then
code = code..tostring(Numbers[math.random(0,#Numbers)]);
end
end
print(code);


~ I fight bosses for a living ~
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
14 Apr 2016 01:32 AM
what an easy way to make people script stuff for you lol

disguise it in a "contest" theme



-Salinas con el número 23
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
14 Apr 2016 01:44 AM
characters = {"F","B","C","G","I","M","Z","V","R","0","1","2","3","4","5","6","7","8","9"}
function gen(num)
str = "";
repeat
srt = str .. characters[math.Random(#characters)];
until string.len(str) == num;
return str
end

gen(7)
Report Abuse
Froast is not online. Froast
Joined: 12 Mar 2009
Total Posts: 3134
14 Apr 2016 02:25 AM
k=table.concat
t=k(Letters)..k(Numbers)
c=''
for i=1,7 do
r=math.random(1,#t)
c=c..t:sub(r,r)
end
Report Abuse
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
14 Apr 2016 07:27 PM
It's not a contest, and I do know how to create a script like this. The contest ends in about 3 hours... So if you'd like to try it give it a shot!
Report Abuse
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
14 Apr 2016 08:07 PM
tbh only scripting this because there was really nothing to do



math.randomseed(math.floor(os.time()))
t = {'A',1,'B',1,'C',2,'D',2,'E',3,'F',3,
'G',4,'H',4,'I',5,'J',6,'K',7,8,'L',9,
'M',1,'N',2,'O',3,'P',4,'Q',5,'R',6,
'S',7,'T',8,'U',9,'V',1,'W',2,'X',3,
'Y',4,'Z',5,'a',6,'b',7,'c',8,'d',9,'e',1,'f',2,
'g',3,'h',4,'i',5,'j',6,'k',7, 'l',8,
'm',9,'n',1,'o',2,'p',3,'q',4,'r',
's',5,'t',6,'u',7,'v',8,'w',9,'x',1,
'y',2,'z',3}

value = ''

for i,v in pairs(t) do
if i == 8 then print (value)
break
end
local m = math.random(1,#t)
value = value..t[math.random(1,#t)]
end




Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
14 Apr 2016 08:08 PM
what an easy way to make people script stuff for you lol

disguise it in a "contest" theme [2]



r+://393244197r+://393244224r+://393244262
Report Abuse
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
14 Apr 2016 09:01 PM
@Trollers

math.randomseed(math.floor(os.time()))
local C={"F","B","C","G","L","M","Z","V","R",0,1,2,3,4,5,6,7,8,9}
local V = ''
for i = 1,7 do
V = V..C[math.random(1,#C)]
end
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
14 Apr 2016 09:27 PM
@OP
2 people posted the exact same thing..
*noob*
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
14 Apr 2016 09:29 PM
local Letters = {"F","B","C","G","I","M","Z","V","R"}
local Numbers = {0,1,2,3,4,5,6,7,8,9}
"Task: Given the TABLES ABOVE create a random code generator that is 7 characters long..."

OP's solution:
local C={"F","B","C","G","L","M","Z","V","R",0,1,2,3,4,5,6,7,8,9}
Report Abuse
Froast is not online. Froast
Joined: 12 Mar 2009
Total Posts: 3134
14 Apr 2016 09:50 PM
lol I was thinking the same thing
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 Apr 2016 10:57 PM
a={"F","B","C","G","I","M","Z","V","R",0,1,2,3,4,5,6,7,8,9}
for i=#a,2,-1 do j=math.random(i)a[i],a[j]=a[j],a[i]end
v=select(12,unpack(a))


139 characters


Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 Apr 2016 11:01 PM
a={"F","B","C","G","I","M","Z","V","R",0,1,2,3,4,5,6,7,8,9}
for i=#a,2,-1 do j=math.random(i)a[i],a[j]=a[j],a[i]end
print(select(12,unpack(a)))



Report Abuse
Repotted is not online. Repotted
Joined: 26 Nov 2011
Total Posts: 4990
14 Apr 2016 11:16 PM
merging lines together doesn't make it 'shorter'

Report Abuse
BossfightX is not online. BossfightX
Joined: 06 Feb 2010
Total Posts: 2962
14 Apr 2016 11:16 PM
@Repotted it actually does in some cases.

~ I fight bosses for a living ~
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
14 Apr 2016 11:18 PM
Assuming I am required to use both tables with those variable names, here's my attempt.

r,s=math.random,""for n=1,7 do a=({Letters,Numbers})[r(2)]s=s..a[r(#a)]end
74 characters


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