Go Back   Flash Flash Revolution > General Discussion > Chit Chat
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
Old 08-12-2013, 11:29 AM   #1
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 35
Posts: 6,205
Default Someone give me a problem to script

Super bored in class today, and I can't think of a way to use what I learned this past week to create any kind of exercise for myself, so I'm asking for some outside input.

I don't know much math past trig, and I'm not an expert with powershell. So take that into consideration.

Anything goes, as long as the result of my script should end up with tangible output. (and don't use any project euler problems, I can't lrn2algorithm yet)
__________________
Choofers is offline   Reply With Quote
Old 08-12-2013, 01:33 PM   #2
Fission
no
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Fission's Avatar
 
Join Date: Jan 2004
Age: 34
Posts: 1,850
Default Re: Someone give me a problem to script

write a script to create anagrams from an input string (you can probably find source for this already but w/e)
Fission is offline   Reply With Quote
Old 08-12-2013, 01:36 PM   #3
benguino
Kawaii Desu Ne?
Retired StaffFFR Veteran
 
benguino's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
Default Re: Someone give me a problem to script

Don't know what diff you are going after but here's one:

Input: A single string that contains words with any amount of comma's and spaces inbetween.

Output: output each word (without the commas and spaces) on a separate line.

Example:

Input: "one, two, ,three,, , 4"
Output:
"one
two
three
4"
__________________
AMA: http://ask.fm/benguino

Not happening now! Don't click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
benguino is offline   Reply With Quote
Old 08-12-2013, 02:20 PM   #4
Arkuski
FFR Veteran
FFR Veteran
 
Join Date: Jul 2006
Location: Rhode Island
Age: 33
Posts: 1,118
Send a message via AIM to Arkuski Send a message via Skype™ to Arkuski
Default Re: Someone give me a problem to script

Write a script that finds a combination of positive integers (x,y,z) that satisfies the formula:

(x^3)+(y^3)=(z^3)
__________________

Quote:
Originally Posted by Wayward Vagabond View Post
i can appreciate a good looking woman when i see one and this one just happened to be my mom
Arkuski is offline   Reply With Quote
Old 08-12-2013, 02:23 PM   #5
benguino
Kawaii Desu Ne?
Retired StaffFFR Veteran
 
benguino's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
Default Re: Someone give me a problem to script

Quote:
Originally Posted by Arkuski View Post
Write a script that finds a combination of positive integers (x,y,z) that satisfies the formula:

(x^3)+(y^3)=(z^3)
Your sense of humor is very dark and sinister :c
__________________
AMA: http://ask.fm/benguino

Not happening now! Don't click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
benguino is offline   Reply With Quote
Old 08-12-2013, 02:46 PM   #6
HalfStep
Can't AAA anything
FFR Veteran
 
HalfStep's Avatar
 
Join Date: Sep 2007
Posts: 1,391
Default Re: Someone give me a problem to script

Oh wow Arkuski that's evil..
__________________

4th Official Tournament - D1 34th Place
5th Official Tournament - D3 Last Place
8th Official Tournament - D3 3rd Place
TSR's Summer Golf Tournament - D4 2nd Place
FFR Multiplayer Tournament 2013 - D5 12th Place
YoshL's Tournament of Mediocrity - 2nd Place
TSR's Rates Tournament - Standard 2nd Place
DRG's Team Tournament - Intermediate 1st Place
9th Official FFR Tournament - D5 35th Place

HalfStep is offline   Reply With Quote
Old 08-12-2013, 02:48 PM   #7
benguino
Kawaii Desu Ne?
Retired StaffFFR Veteran
 
benguino's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
Default Re: Someone give me a problem to script

Here's one that might peak your interest if you're bored.

Input: an integer n
Output: The average distance between consecutive primes between (and including) 2 to n.

Example:
Input: 5
Output: 1.5
(Solution: There are three primes in that range: 2,3,5. The distance between 2 and 3 is 1 and the distance between 3 and 5 is 2. The average of all distances (1 and 2) is 1.5)

Also, see if you can formulate some conjecture or educated guess on how the output changes as in the input increases.
__________________
AMA: http://ask.fm/benguino

Not happening now! Don't click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
benguino is offline   Reply With Quote
Old 08-12-2013, 03:19 PM   #8
Zapmeister
FFR Player
 
Join Date: Sep 2012
Location: England
Posts: 466
Default Re: Someone give me a problem to script

write a program that takes as its input another program and outputs that same program with extra whitespace inserted to make it physically look like a toilet roll, but still be functional

(a friend-of-a-friend of mine did that in c++ as an assigned project)
__________________

Theorem: If you have a large enough number of monkeys, and a large enough number of computer keyboards, one of them will sight-read AAA death piano on stealth. And the ffr community will forever worship it. Proof Example

ask me anything here

mashed FCs: 329

r1: 5
r2: 4
r3: 6
r4: 8
r5: 3
r6: 5
r7: 15
final position: 4th
Zapmeister is offline   Reply With Quote
Old 08-12-2013, 03:33 PM   #9
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 35
Posts: 6,205
Default Re: Someone give me a problem to script

if by valid anagrams you mean anagrams that make at least some sense, then that might be tough because I'd need a dictionary... unless I'm missing something

arkuski you're gay and I'm dumb as shit

Quote:
Originally Posted by reuben_tate View Post
Don't know what diff you are going after but here's one:

Input: A single string that contains words with any amount of comma's and spaces inbetween.

Output: output each word (without the commas and spaces) on a separate line.

Example:

Input: "one, two, ,three,, , 4"
Output:
"one
two
three
4"
Code:
cls
$strInput = read-host "insert string"
$strNoCom = $strInput.Split(',')
$strNoSpace = $strNoCom.Split(' ')
$arrOutput = @()
$intCount = 0
$intCount2 = 0

do{
    $strTemp = $strNoSpace[$intCount]

    if ($strTemp.Length -gt 1){
        $arrOutPut += $strTemp
        $intCount2++
        }
    $intCount++
}
until($intCount -eq $strNoSpace.length)

$arrOutput


that prime one sounds super interesting, but I am seriously shit at math so I would have no idea how to efficiently test a number to see if it's prime
__________________
Choofers is offline   Reply With Quote
Old 08-12-2013, 03:33 PM   #10
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 35
Posts: 6,205
Default Re: Someone give me a problem to script

Quote:
Originally Posted by Zapmeister View Post
write a program that takes as its input another program and outputs that same program with extra whitespace inserted to make it physically look like a toilet roll, but still be functional

(a friend-of-a-friend of mine did that in c++ as an assigned project)
also

what the christ
__________________
Choofers is offline   Reply With Quote
Old 08-12-2013, 03:37 PM   #11
benguino
Kawaii Desu Ne?
Retired StaffFFR Veteran
 
benguino's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
Default Re: Someone give me a problem to script

Quote:
Originally Posted by Choofers View Post
that prime one sounds super interesting, but I am seriously shit at math so I would have no idea how to efficiently test a number to see if it's prime
There are more efficient ways but the most brute force and intuitive way is to see if it is divisible by any numbers before it (which you can check by using a mod operator like % or whatever it may be in the programming language you use)
__________________
AMA: http://ask.fm/benguino

Not happening now! Don't click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
benguino is offline   Reply With Quote
Old 08-12-2013, 03:57 PM   #12
axith
FFR Veteran
FFR Simfile AuthorFFR Veteran
 
axith's Avatar
 
Join Date: Dec 2007
Posts: 1,251
Default Re: Someone give me a problem to script

Quote:
Originally Posted by reuben_tate View Post
There are more efficient ways but the most brute force and intuitive way is to see if it is divisible by any numbers before it (which you can check by using a mod operator like % or whatever it may be in the programming language you use)
To make this slightly more efficient, testing though the number's square root is sufficient.
axith is offline   Reply With Quote
Old 08-12-2013, 04:16 PM   #13
benguino
Kawaii Desu Ne?
Retired StaffFFR Veteran
 
benguino's Avatar
 
Join Date: Dec 2007
Location: The Kawaiian Island~
Age: 32
Posts: 4,185
Default Re: Someone give me a problem to script

^This will help a lot and save you some time
__________________
AMA: http://ask.fm/benguino

Not happening now! Don't click to join!



Quote:
Originally Posted by Spenner View Post
(^)> peck peck says the heels
Quote:
Originally Posted by Xx{Midnight}xX
And god made ben, and realized he was doomed to miss. And said it was good.
Quote:
Originally Posted by Zakvvv666
awww :< crushing my dreams; was looking foward to you attempting to shoot yourself point blank and missing
benguino is offline   Reply With Quote
Old 08-12-2013, 04:32 PM   #14
Fission
no
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Fission's Avatar
 
Join Date: Jan 2004
Age: 34
Posts: 1,850
Default Re: Someone give me a problem to script

Quote:
Originally Posted by Choofers View Post
if by valid anagrams you mean anagrams that make at least some sense, then that might be tough because I'd need a dictionary... unless I'm missing something
yes to making sense, yes to needing a dictionary, and no you aren't missing anything.

also, for this specific prime number problem that ben mentioned, sieve of eratosthenes is your best friend since you are trying to find all of the prime numbers in a range. research and try to implement it. there is better algorithms, but they are more complicated to implement.

Last edited by Fission; 08-12-2013 at 04:36 PM..
Fission is offline   Reply With Quote
Old 08-12-2013, 04:39 PM   #15
trumaestro
I don't get no respect
FFR Simfile AuthorFFR Veteran
 
trumaestro's Avatar
 
Join Date: Jun 2006
Age: 34
Posts: 1,332
Default Re: Someone give me a problem to script

Write a program that takes as it's input any ddreamstudio file.

Output a list of BPM changes such that if there is any BPM change within 5 BPM of an adjacent one, the first one should be redone as the average of those BPMs while the others are removed. Don't redo BPMs if they are not all within 5 BPM of each other. Do not use your calculated averages in another calculation.

eg.
in (parse file to bpm changes) 0=141, 3=143, 19=147, 28=149
out 0=142, 19=148

Sample input if you need some

Code:
#TITLE:Mr. Marlowe;
#SUBTITLE:;
#ARTIST:rega;
#CREDIT:;
#MUSIC:rega  Mr.MARLOWE.mp3;
#SELECTABLE:YES;
#BACKGROUND:;
#BANNER:;
#CDTITLE:;
#OFFSET:-2.97127;
#SAMPLESTART:99.580;
#SAMPLELENGTH:12.000;
#BPMS:0=133.623,1=128.123,2=131.668,3=138.737,4=131.081,5=124.982,6=134.492,7=125.018,8=135.692,9=132.214,10=133.927,11=127.838,12=136.272,13=136.582,14=126.785,15=140.955,16=137.177,17=120.64,18=121.098,19=139.963,20=138.737,21=132.512,22=142.22,23=135.685,24=134.499,25=136.9,26=136.582,27=136.9,28=142.565,29=140.625,30=135.999,31=123.265,32=127.845,33=129.725,34=134.492,35=133.367,36=132.771,37=135.11,38=135.637,39=138.737,40=132.221,41=134.233,42=130.544,43=136.582,44=132.765,45=132.512,46=133.072,47=134.801,48=129.439,49=137.813,50=135.38,51=133.968,52=134.192,53=133.927,54=136.265,55=133.072,56=133.927,57=133.367,58=131.374,59=133.367,60=132.765,61=133.934,62=138.086,63=127.328,64=133.927,65=133.934,66=131.668,67=138.411,68=131.917,69=136.9,70=131.374,71=133.934,72=138.411,73=133.065,74=133.927,75=134.233,76=133.63,77=128.117,78=134.185,79=134.233,80=132.221,81=133.927,82=134.801,83=131.917,84=141.588,85=133.072,86=137.49,87=132.214,88=135.685,89=130.544,90=130.261,91=137.813,92=135.11,93=134.492,94=128.117,95=140.297,96=133.065,97=142.565,98=133.67,99=141.877,100=130.012,101=131.081,102=137.177,103=136.314,104=123.524,105=135.373,106=136.272,107=135.685,108=131.374,109=135.999,110=136.582,111=135.11,112=133.927,113=130.551,114=138.086,115=133.367,116=136.265,117=138.093,118=136.314,119=134.233,120=138.086,121=131.668,122=134.801,123=133.927,124=133.934,125=135.11,126=133.927,127=136.9,128=133.927,130=134.499,131=133.367,132=136.265,133=135.999,134=138.411,135=136.582,136=137.813,137=125.024,138=142.857,139=122.285,140=126.821,141=133.927,142=140.625,143=127.838,144=117.189,145=133.927,146=127.845,147=138.411,148=135.95,149=137.813,150=133.072,151=135.11,152=131.374,153=121.098,154=133.927,155=127.845,156=133.927,157=130.544,158=140.917,159=125.51,160=134.192,161=127.604,162=133.927,163=133.367,164=137.17,165=137.49,166=132.221,167=132.512,168=133.623,169=134.801,170=136.272,171=133.367,172=137.49,173=130.012,174=139.344,175=132.765,176=139.351,177=127.604,178=132.512,179=127.838,180=138.694,181=137.813,182=134.233,184=137.49,185=130.789,186=135.11,187=133.072,188=138.411,189=137.49,190=138.549,191=128.278,192=127.451,192.521=128.275,193=130.405,193.521=130.44,194=131.498,195=134.492,196=132.512,197=131.38,198=140.625,199=134.233,200=125.546,201=243.199,202=139.535,203=141.93,204=143.703,205=138.927,206=143.058,207=138.411,208=138.599,209=153.694,210=144.409,211=139.058,212=138.737,213=142.419,214=140.625,215=140.767,216=145.273,217=144.709,218=139.066,219=140.483,220=140.767,221=138.737,222=136.765,223=140.289,224=142.075,225=153.694,226=139.675,227=139.205,228=142.911,229=142.857,230=142.419,231=139.205,232=155.428,233=138.737,234=142.075,235=138.136,236=138.599,237=142.22,238=138.737,239=141.93,240=161.934,241=128.922,242=137.212,243=143.555,244=141.105,245=141.256,246=142.411,247=139.395,248=144.859,249=140.625,250=140.148,251=140.297,252=142.411,253=137.497,254=140,255=134.233,256=140.007,257=152.34,258=136.9,259=140.625,260=143.898,261=138.737,262=145.225,263=121.599,264=140.625,265=159.014,266=142.565,267=131.668,268=135.999,269=133.927,270=139.014,271=137.49,272=135.999,273=137.497,274=134.233,275=132.512,276=137.49,277=138.411,278=138.086,279=137.813,280=139.675,281=133.367,282=141.588,283=132.221,284=133.367,285=140.625,286=134.492,287=142.857,288=136.9,289=139.066,290=144.204,291=135.999,292=140.625,293=134.233,294=142.565,295=138.737,296=139.675,297=143.555,298=133.072,299=144.559,300=137.49,301=145.577,302=132.811,303=144.559,304=138.737,305=142.565,306=135.415,307=148.352,308=134.533,309=140.297,310=135.999,311=145.577,312=141.248,313=136.314,314=130.544,315=140.625,318=132.765,319=145.217,320=142.565,321=140.007,322=130.012,323=147.286,324=143.906,325=147.656,326=141.588,327=139.675,328=138.411,329=137.219,330=134.233,331=125.018,332=159.696,333=2736.3,334=142.565,335=11504.3,336=127.845,337=2335.39,338=122.79,339=134.185,340=135.692,341=140.573,342=137.177,343=141.195,344=137.813,345=101.162,346=122.279,347=133.927,348=133.934,349=140.625,350=133.927,351=140.625,352=133.927,353=156.254,354=133.927,355=140.625,356=148.028,357=140.625,363=144.204,364=135.685,365=134.492,366=130.835,367=133.934,368=131.668,369=127.838,370=133.927,371=140.625,373=133.927,374=148.719,375=135.692,376=136.9,377=141.248,378=153.525,379=135.11,380=134.233,381=138.737,382=137.212,383=137.813,384=140.148,385=141.105,386=138.883,387=143.555,388=130.958,389=142.711,390=132.214,391=142.22,392=137.355,393=144.409,394=142.075,395=140.289,396=138.273,397=142.911,398=142.711,399=136.765,400=140.767,401=138.737,403=140.148,404=139.675,405=138.273,406=139.822,407=140.476,408=138.737,409=138.273,410=141.444,411=137.949,412=141.256,413=137.355,414=141.588,415=143.555,416=138.737,418=148.02,419=138.418,420=135.999,421=149.087,422=140.962,423=139.344,424=156.254,425=133.927,426=148.028,427=140.625,428=133.927,429=140.625,430=133.927,431=140.625,436=148.028,437=127.845,438=152.78,439=134.54,440=146.609,441=148.719,442=136.9,443=144.559,444=139.956,445=137.813,446=129.446,447=127.604,448=133.065,449=142.565,450=152.393,451=121.348,452=139.014,453=129.199,454=134.807,455=150.17,456=103.89,456.479=102.539;
#STOPS:;
//---------------dance-single - ----------------
#NOTES:
     dance-single:
     :
     Beginner:
     1:
     0.000,0.000,0.000,0.000,0.000:
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
,
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
;
//---------------dance-single - ----------------
#NOTES:
     dance-single:
     :
     Challenge:
     1:
     0.000,0.000,0.000,0.000,0.000:
0100
0100
0100
0100
,
0110
1000
0000
0000
0000
0000
0110
1000
0000
0000
0000
0000
0110
1000
0000
0000
0000
0000
0110
1000
0000
0000
0000
0000
,
0101
0101
0101
0101
,
0001
0010
0001
0000
0010
0001
0010
0000
0001
0010
0001
0000
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
0000
0000
1000
1000
1000
1000
1000
1000
,
1000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
,
0000
0000
0000
0000
;

Last edited by trumaestro; 08-12-2013 at 04:48 PM..
trumaestro is offline   Reply With Quote
Old 08-12-2013, 04:51 PM   #16
MrGiggles
Senior Member
FFR Veteran
 
MrGiggles's Avatar
 
Join Date: Aug 2005
Location: Skaia
Age: 23
Posts: 2,846
Send a message via AIM to MrGiggles Send a message via MSN to MrGiggles
Default Re: Someone give me a problem to script

How about wordcounters, I had fun with those because of all the little extra things you can work towards (ignoring numbers, acronyms, common words, etc) and it's not mathy at all

bonus points if you use a sorting algorithm of your choice to sort in descending order of occurrence

triple bonus points if it outputs a wordcloud rather than a list
__________________
MrGiggles is offline   Reply With Quote
Old 08-12-2013, 05:10 PM   #17
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 35
Posts: 6,205
Default Re: Someone give me a problem to script

okay yeah, that prime number one looks a LOT easier now, gonna have to write some pseudo-code tonight and then I'll script it tomorrow at lunch

for the DDReam one, that'll take a bit, I think. I don't know much about .ds files too, are they relatively the same as .sm files?

the word counter would be trivial but I don't think powershell has the power (HEH) to generate wordclouds. maybe if I stopped being lazy and picked up javascript or java again.
__________________

Last edited by Choofers; 08-12-2013 at 05:13 PM..
Choofers is offline   Reply With Quote
Old 08-12-2013, 05:12 PM   #18
PaperclipGames
Mrow~
FFR Veteran
 
PaperclipGames's Avatar
 
Join Date: May 2008
Location: Netherlands
Age: 33
Posts: 648
Send a message via MSN to PaperclipGames Send a message via Skype™ to PaperclipGames
Default Re: Someone give me a problem to script

On prime testing: create a list with primes, and for any next number you only need to test if it is divisable by any element in that list that is smaller than or equal to the square root of the number you're testing. If not, add it to the list of primes. Continue until you feel satisfied.

For the number 100, you'd only have to check if it is divisible by any element in {2,3,5,7} since only those primes are leq 10. Of course you can immediately stop after checking 2, but the point is clear.

(The reason that going through the square root is enough is because if your number n equals p*k for a p>sqrt(n) then k<sqrt(n) and you'd have found k already.)

Edit: Using this method also makes it really easy to make another list that calculates the prime gaps.
__________________
948 AAAs | 1461 FCs | 549 TPs | 7 FMO AAAs
Best AAAs: Exciting Hyper Highspeed Star (69), Nous (69), Pure Ruby (68), Heavenly Spores (68), Ambient Angels (66), Within Life (66), Defection (66) Southern Cross (65)

Last edited by PaperclipGames; 08-12-2013 at 05:14 PM..
PaperclipGames is offline   Reply With Quote
Old 08-12-2013, 06:44 PM   #19
shenjoku
Wubalubadubdub
FFR Veteran
 
shenjoku's Avatar
 
Join Date: May 2005
Age: 38
Posts: 1,697
Default Re: Someone give me a problem to script

I don't know anything about powershell or how hard you want this to be so here's a fairly common (I think) somewhat easy interview question:

Write a program that takes in a string, reverses it, and prints the result. Try to do this as efficiently as possible, that's the hard part
__________________
boop
shenjoku is offline   Reply With Quote
Old 08-12-2013, 06:51 PM   #20
igotrhythm
Fractals!
FFR Veteran
 
igotrhythm's Avatar
 
Join Date: Sep 2004
Location: Meesheegan
Age: 40
Posts: 6,535
Send a message via Skype™ to igotrhythm
Default Re: Someone give me a problem to script

Quote:
Originally Posted by Choofers View Post
if by valid anagrams you mean anagrams that make at least some sense, then that might be tough because I'd need a dictionary... unless I'm missing something

arkuski you're gay and I'm dumb as shit



Code:
cls
$strInput = read-host "insert string"
$strNoCom = $strInput.Split(',')
$strNoSpace = $strNoCom.Split(' ')
$arrOutput = @()
$intCount = 0
$intCount2 = 0

do{
    $strTemp = $strNoSpace[$intCount]

    if ($strTemp.Length -gt 1){
        $arrOutPut += $strTemp
        $intCount2++
        }
    $intCount++
}
until($intCount -eq $strNoSpace.length)

$arrOutput


that prime one sounds super interesting, but I am seriously shit at math so I would have no idea how to efficiently test a number to see if it's prime
If m % n != 0 for all prime integers n < sqrt(m), then m is prime. Probably how you'd write what Paperclip and Axith said. So for 11, it would test for 2 and 3, then stop and conclude that 11 is prime since 5 > sqrt(11), but the problem there would be the fact that you'd have to populate the list of test numbers from scratch every time. You'd also have to define 2 and 3 as prime to give you a leg up on populating the list of test divisors.

As you can see, the runtime would go up quite quickly even to 100 because then you're running stuff for 49 that's like "2, yes. 3, yes. 5, yes. 7, no. 49 is not prime, do not add it to the list of test divisors, on to 50." As you can see, the sieve of Erastothenes is probably better for numbers in a range 1 to n inclusive. Remove 1, spare 2, remove all multiples of 2. Spare 3, remove all multiples of 3. Next number is 5, so remove all multiples of 5, and so on.
__________________
Quote:
Originally Posted by thesunfan View Post
I literally spent 10 minutes in the library looking for the TWG forum on Smogon and couldn't find it what the fuck is this witchcraft IGR

Last edited by igotrhythm; 08-12-2013 at 06:58 PM..
igotrhythm is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 09:58 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution