JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 28 Apr 2017 01:29 PM |
Here's another code golf challenge for you guys to try.
scripters.boards .net/ thread/52/random-integer-english
See how short you can complete the task in.
(and join the forum if ya want *hint*)
Josh#5318 |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2017 01:45 PM |
a=math.random c=10000 b=a(c)while b>1 do b=a(c)end print"one" yay |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2017 01:46 PM |
| Josh I'm gonna start calling you Lightning ######## Why you ask? "Speed. I am speed." |
|
|
| Report Abuse |
|
|
| |
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 28 Apr 2017 01:48 PM |
Ok :p Well done on finding a flaw :P
Have a go at doing it!
Josh#5318 |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
| |
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
|
| 28 Apr 2017 01:55 PM |
| Probably not the shortest: ################################################################## b=tostring(math.random(10000)) for i=1,b.len()do c=tonumber(b[i]) ###### ### #### ## 'zero' print(d) end |
|
|
| Report Abuse |
|
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
| |
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 28 Apr 2017 02:03 PM |
Looks good caca, I've managed to take 11 chars off your solution.
Josh#5318 |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2017 02:05 PM |
| I don't like your forum, Josh. |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 28 Apr 2017 02:07 PM |
@caca
Your solution doesn't actually work, you will have to replace b[i] with b:sub(i,i).
Why not Intended?
Josh#5318 |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2017 02:07 PM |
does the output need to be on the same line?
one two one two
|
|
|
| Report Abuse |
|
|
|
| 28 Apr 2017 02:08 PM |
| It's ugly and the actual forums make no sense. |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 28 Apr 2017 02:10 PM |
@10Mile, they do, yes.
Why not? What's wrong with them? @Intended
Josh#5318 |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2017 02:12 PM |
They're just random and I could talk about everything about them here.
I don't see the point in it besides there's no filter.
I mean, for the love of peace, you're even posting your "code golf" here. |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2017 02:14 PM |
a,b,c={"zero","one","two","three","four","five","six","seven","eight","nine"},""..math.random(10000),"" for i=1,#b do c=c..a[b:sub(i,i)+1].." "end print(c) |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 28 Apr 2017 02:18 PM |
I just post them here so more people have the opportunity to participate.
It's just a filterless scripting community split up into separate subforums with a better forum interface.
Josh#5318 |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 28 Apr 2017 02:18 PM |
Looks good @10Miles!
Josh#5318 |
|
|
| Report Abuse |
|
|