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, 07:00 PM   #21
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 shenjoku View Post

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
$a = "string"
[array]::Reverse($a)
write-host $a

that's the nice thing about powershell, working with anything other than numbers is generally very very easy
__________________
Choofers is offline   Reply With Quote
Old 08-12-2013, 09:01 PM   #22
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

lmao never mind then XD Shoulda figured as much since it's a scripting language.
__________________
boop
shenjoku is offline   Reply With Quote
Old 08-12-2013, 09:04 PM   #23
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

string reversal is much more relevant in a language like c/c++ that uses character arrays to store strings since most of what the string reversal problem is is linked list manipulation

EDIT: it depends on how the strings are stored internally too. this is based on the assumption that they are stored as a linked list (no implementation does this, afaik). string reversal is trivial with a dynamic array.

Last edited by Fission; 08-12-2013 at 09:21 PM..
Fission is offline   Reply With Quote
Old 08-12-2013, 10:17 PM   #24
Wayward Vagabond
Confirmed Heartbreaker
Retired StaffFFR Simfile AuthorFFR Veteran
 
Wayward Vagabond's Avatar
 
Join Date: Jul 2012
Age: 37
Posts: 5,866
Default Re: Someone give me a problem to script

Quote:
Originally Posted by Choofers View Post
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.
I think trumaestro means a sm file made with ddream
__________________
Wayward Vagabond is offline   Reply With Quote
Old 08-12-2013, 10:18 PM   #25
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

Quote:
Originally Posted by Wayward Vagabond View Post
I think trumaestro means a sm file made with ddream
Essentially. You can treat either as a text file though.
trumaestro is offline   Reply With Quote
Old 08-12-2013, 10:19 PM   #26
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 35
Posts: 6,205
Default Re: Someone give me a problem to script

oh cool
__________________
Choofers is offline   Reply With Quote
Old 08-12-2013, 10:35 PM   #27
Zephei
The Supreme Bean
D7 Elite KeysmasherFFR Veteran
 
Zephei's Avatar
 
Join Date: Nov 2011
Location: Iowa, Earth
Age: 28
Posts: 297
Send a message via Skype™ to Zephei
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)
Damn, someone else already said that joke.

The prime number problem is a good one. Try using the sieve of eratosthenes.
__________________
Expert AAAs: 22
Master AAAs: 11
Guru AAAs: 9

Zephei is offline   Reply With Quote
Old 08-12-2013, 11:28 PM   #28
beary605
FFR Veteran
D8 Godly KeysmasherFFR Veteran
 
beary605's Avatar
 
Join Date: Oct 2008
Location: Canada
Posts: 448
Default Re: Someone give me a problem to script

The Four Fours?
beary605 is offline   Reply With Quote
Old 08-13-2013, 02:20 AM   #29
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 another one if you finish the rest are looking for more. I'll put it in spoilers so you can open it when you are ready instead of seeing the problem and being pressured to solve it (if you already have a good queue of problems to solve).


Tic Tac Toe AI

You're goal will be to make an AI smart enough to make not-dumb moves in Tic Tac Toe.

Input: a 3x3 matrix of strings. This is the current tic tac toe grid before the AI's turn. This matrix is filled with "X"s, "O"s, and empty strings to denote open spots. The AI is playing as X's.
Output: the 3x3 matrix that results after the AI you programmed has made it's move.

Requirements:
-If it is possible for the AI to win on that turn, you must make the move that allows the AI to win on that turn.
-If it is not possible for the AI to win this turn and it is possible for your opponent to win on his next turn, you must block him to prevent him from winning. If it is guarenteed your opponent will win next turn however, print "FUUUUUU..." and make whatever move you please.
-If none of the other cases hold above, make the move either via RNG or a method of your choosing.
__________________
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-13-2013, 01:17 PM   #30
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 35
Posts: 6,205
Default Re: Someone give me a problem to script

Got sieve implemented, that was fun to write. :P Script is super messy but I'll comment everything and make it look pretty once I get the full thing up and running.

Code:
$n = read-host "input integer"
$A = $False,$False
$x = 2
$B = @()

do{
    $A += $True
    $x++
    }
until($x -eq [int]$n+1)

$i = 2

do{
write-host "Current value of i is $i."
    if($A[$i] -eq $True){
    $x = 0
    do{
           
            $j = ($i*$i)+($i*$x)
            write-host "Current value of j is $j."
            if($j -gt $n){                
            }
            else{
            $A[$j] = $False
            }
            $x++
            write-host "Current value of x is $x."
            }
        while($j -lt $n)
        }
        $i++
    }
while($i -lt [system.math]::Sqrt($n))

$x = 0

do{
    if($a[$x] -eq $true){
        [array]$B += $x
        }
        $x++
        }
        until($x -eq $n)
    
    $B
__________________
Choofers is offline   Reply With Quote
Old 09-4-2013, 09:57 AM   #31
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 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)
I finally googled this.

You're a dick :C
__________________
Choofers is offline   Reply With Quote
Old 09-4-2013, 11:36 AM   #32
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

Yup
__________________
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 09-4-2013, 12:59 PM   #33
Tim Allen
B^)
FFR Veteran
 
Tim Allen's Avatar
 
Join Date: Jul 2013
Age: 31
Posts: 1,129
Send a message via Skype™ to Tim Allen
Default Re: Someone give me a problem to script

Part of my "job" has me switching the status of these TMS trips from uncompleted to done.. I do this several thousands of times every few days and it's so annoying. Is there any way you could write something up that will do this for me? I'll give you more info when I get to a computer if you're willing.
__________________
Tim Allen is offline   Reply With Quote
Old 09-5-2013, 03:12 PM   #34
Choofers
FFR Player
FFR Music Producer
 
Join Date: Dec 2008
Age: 35
Posts: 6,205
Default Re: Someone give me a problem to script

TMS trips?
__________________
Choofers 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:14 PM.


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