Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Random Play CD
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
michael_li13




PostPosted: Tue Jan 24, 2006 5:48 pm   Post subject: Random Play CD

I already posted a question like this, but it was a subcategory so alot of people probably didn't see it. I need to play a CD on random with Turing without replaying tracks and stopping the CD when it's finished. Could someone tell me how to do this in more detail than just use an array, or check the tutorials. Please show an example in code. PLZ help!!!!!
Sponsor
Sponsor
Sponsor
sponsor
iker




PostPosted: Tue Jan 24, 2006 6:44 pm   Post subject: (No subject)

lets say the cd has 12 tracks
code:

var playtrack : int
var track : array 1 .. 12 of boolean
var trackstring : string
for i : 1 .. 12
    track (i) := false
end for
loop
    loop
        randint (playtrack, 1, 12)
        if track (playtrack) = false then
            track (playtrack) := true
            exit
        end if
    end loop
    trackstring := intstr (playtrack)
    Music.PlayFile ("cd:" + trackstring)
end loop


there you go, a program that should randomly play all tracks ONCE. If you want to make it play over or have a different amount of tracks then make some adjustments.
if it doesn't work, then i'm sorry[/i]
michael_li13




PostPosted: Tue Jan 24, 2006 7:07 pm   Post subject: Thanks!!!

You are a god. Thanks so much, I've been looking for days (unbelievable eh?)!
iker




PostPosted: Tue Jan 24, 2006 7:20 pm   Post subject: Re: Thanks!!!

michael_li13 wrote:
You are a god. Thanks so much, I've been looking for days (unbelievable eh?)!


wouldn't say a god, just someone who has knowledge in turing... But don't you be expecting for someone to swoop in and tell you everything or do your programs for you all the time on this website. I only did that because it is an EXTREMELY easy concept, and didn't think theres any way of giving just an example...
please feel free to prove me wrong now, please
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: