View Full Version : I'm trying to make a "C" script to play clips in random order.
Jeremy Duncan
23rd April 2011, 23:40
I want to take these clips, have clip one as the beginning and clip 27 as the ending, but the clips inbetween varied.
I want to vary the clips 2 to 26 so they play in a special random order.
That special random order is based on boolean true false statement, like this;
int main()
{ int one, two, three;
one=1;
two=2;
three=3;
if((two<=three)&&(three>=1));
play clip two;
else play clip 3;
variable name is one.
variable name value is 1.
How do I add the number of frames in the clip to variable name value?
The clips would have to have these numbers from the number of frames to make the clips have the values; greater than, equal to, or less than.
What gives the clips special values is total frame numbers in the clips, but I don't know how to add that to the variable name value.
So I want you to do two things for me:
1.) add frame number values to the variable name's number. Right now I have one=1, two=2, but it could be, one=("clip has this many frames:")
2.) make the clips play in the order I specified: one is the beginning of the video sequence, two is the last clip in the video sequence, join these beginning and ending clips is clips 2 to 26.
3.) Could you do write your answer in C not C++? I'm learning C and this would help me more than you can imagine.
Here is the source; link (http://www.mediafire.com/?95s27fp44vo2t2e), made up of clips one to 27. Put the clips folder in the C:\ folder.
And here is the start of the avs file I made so you only have to write the code instead of drafting this monotonous work.
loadplugin("C:\Program Files\AviSynth 2.5\plugins\DirectShowSource.dll")
one=directshowsource("C:\clips\1.mp4", audio=false, 23.976)
two=directshowsource("C:\clips\2.mp4", audio=false, 23.976)
three=directshowsource("C:\clips\3.mp4", audio=false, 23.976)
four=directshowsource("C:\clips\4.mp4", audio=false, 23.976)
five=directshowsource("C:\clips\5.mp4", audio=false, 23.976)
six=directshowsource("C:\clips\6.mp4", audio=false, 23.976)
seven=directshowsource("C:\clips\7.mp4", audio=false, 23.976)
eight=directshowsource("C:\clips\8.mp4", audio=false, 23.976)
nine=directshowsource("C:\clips\9.mp4", audio=false, 23.976)
ten=directshowsource("C:\clips\10.mp4", audio=false, 23.976)
eleven=directshowsource("C:\clips\11.mp4", audio=false, 23.976)
twelve=directshowsource("C:\clips\12.mp4", audio=false, 23.976)
thirteen=directshowsource("C:\clips\13.mp4", audio=false, 23.976)
fourteen=directshowsource("C:\clips\14.mp4", audio=false, 23.976)
fifteen=directshowsource("C:\clips\15.mp4", audio=false, 23.976)
sixteen=directshowsource("C:\clips\16.mp4", audio=false, 23.976)
seventeen=directshowsource("C:\clips\17.mp4", audio=false, 23.976)
eighteen=directshowsource("C:\clips\18.mp4", audio=false, 23.976)
nineteen=directshowsource("C:\clips\19.mp4", audio=false, 23.976)
twenty=directshowsource("C:\clips\20.mp4", audio=false, 23.976)
twenty_one=directshowsource("C:\clips\21.mp4", audio=false, 23.976)
twenty_two=directshowsource("C:\clips\22.mp4", audio=false, 23.976)
twenty_three=directshowsource("C:\clips\23.mp4", audio=false, 23.976)
twenty_four=directshowsource("C:\clips\24.mp4", audio=false, 23.976)
twenty_five=directshowsource("C:\clips\25.mp4", audio=false, 23.976)
twenty_six=directshowsource("C:\clips\26.mp4", audio=false, 23.976)
twenty_seven=directshowsource("C:\clips\27.mp4", audio=false, 23.976)
Jeremy Duncan
24th April 2011, 12:31
If you would rather make the code from edit one in the first post in C++, then please do so. All I need is for it to be a functional plugin.
I will get to C++ after I learn C.
Groucho2004
24th April 2011, 21:25
If you would rather make the code from edit one in the first post in C++, then please do so. All I need is for it to be a functional plugin.
Do you want fries with that?
Jeremy Duncan
25th April 2011, 01:15
Hi Groucho,
I didn't expect any help, but I thought what could it hurt to ask?
I'm reading the guide made by D graft on how to make a avisynth plugin. I'm going to read that once a day along with my C course and then try my hand at c++ and then trying to make that plugin.
Don't bother trying to help me if you don't want to, it's not that important - I'll do it.
Groucho2004
25th April 2011, 08:09
OK, I'll bite.
From what I understand, you want to play a directory with a bunch of clips in random order, right?
The pseudo code you posted does not make any sense:
That special random order is based on boolean true false statement, like this;
int main()
{ int one, two, three;
one=1;
two=2;
three=3;
if((two<=three)&&(three>=1));
play clip two;
else play clip 3;
The bold condition is always true because 2 is always < 3 and 3 is always > 1.
So, if you want help, we'll need to know what random order you want.
Adding the number of frames to the file name of a clip is quite simple, the easiest would probably be getting the number of frames through mediainfo and then renaming with some VB script (yuk).
Also, why do you have to involve Avisynth? Why not play the clips directly in your media player?
Jeremy Duncan
25th April 2011, 11:37
bad code removed
It looks like this, and then you just fill in enough if statments then add else statements so all 27 clips are used.
I added two if statments but I could have put twenty there or so.
It compiles in visual studio 2010 express, so the code is good.
And your statement: "2 is always < 3 and 3 is always > 1." is false because the variable name value is not set as equal to the name of the variable: two= (2>= 10) = true, possibly, if the number of frames in two is up to ten frames.
Why use avisynth instead of just making it like a youtube video? Because I envision a folder with different clips from different movies or shows from youtube, but all in the same folder, then the avisynth file goes to that folder and plays the clips based on the boolean values in the avisynth code.
It would look different every time I changed the clips in the folder.
I don't know the Exact boolean math oto use. I would have to get it running then test it to see the values tha give the most pleasing results when I watch the clip.
How are you going to help? Will you make this into a avsi? :thanks:
Gavino
25th April 2011, 12:01
It compiles in visual studio 2010 express, so the code is good.
Just because it compiles doesn't mean it does anything sensible, or even works at all.
For example:
/* initialize all the movies in the array */
for ( one = 1; one <= twenty_seven; ++one ) {
if((two<=three)&&(three>=1));
{
movies[three]=movies[two];
}
if((four<nine)&&(five>=1));
{
movies[nine]=movies[four];
}
The semicolons terminate the two 'if' statements, so they have an empty body and the following { .. } blocks are executed unconditionally. Further, you are using movies[two] and movies[four] before they have been initialised, producing garbage results.
I have no idea what you're trying to do and your code looks like complete nonsense to me.
The idea of "turning C code into an avsi" doesn't make much sense either.
Groucho2004
25th April 2011, 13:16
It compiles in visual studio 2010 express, so the code is good.
That's a keeper! I might put this in my signature with your permission.
Zarxrax
25th April 2011, 14:04
Unless there is a reason that it needs to be in C, this can be done quite easily with a macro for AvsP(mod).
I was actually already thinking about writing something for this purpose, as I needed a way to randomize clips as well.
I can look into it later today or later this week maybe, if that would be satisfactory.
LaTo
25th April 2011, 15:13
That's a keeper! I might put this in my signature with your permission.
Signed JD, as usual (http://forum.doom9.org/showthread.php?t=142706&page=2) :rolleyes:
Otherwise it might be better to read some books about C/C++ and some examples of avisynth's SDK before starting a plugin from scratch...
Jeremy Duncan
25th April 2011, 17:42
[CODEcode removed. new code with no colpiling errors posted below.[/CODE]
But otherwise, how does the code look so far? :)
Zarxrax
25th April 2011, 17:54
Heres the macro i made for avsp, if it might be of help.
http://www.mediafire.com/?4ifpdzcabzchyha
You select a directory containing all the files you want to add, and it will add them all to a new script in a random order
Jeremy Duncan
25th April 2011, 18:05
Hi Zarxrax,
I looked at your py file but it's not what I was looking for.
Actually if I can ask Gavino to look at the code I just posted with the compiling errors, and say if it's sound method just fix the errors, then may I ask you to put the code into a py file once the compiling errors are fixed? :)
That would be cool, then I could just add the clips from post one to a folder and open them with the py file and avsp mod. :)
Zarxrax
25th April 2011, 18:12
Well python is quite different from C, so I dunno.
Jeremy Duncan
25th April 2011, 18:33
This code has no compiling errors.
bad code removed
Zarxrax, maybe try to put this code into python code, and use the clips in the first post in avsp with the py file you make to see if our code works? :)
Zarxrax
25th April 2011, 18:49
Hmm... I dont really understand your code :p
Jeremy Duncan
25th April 2011, 21:01
Hmm... I dont really understand your code :p
What is it doing you mean?
The for loop is made up of:
variable name = int number
test step: variable name <= int value or name
increment step: variable name ++
I use my imagination to describe what this does:
The for loop is a circle that has a circumference, and this circumference is the (variable name=int number) step.
The test step is the centre of the circle.
The increment step is what joins the circumference with the centre of the circle.
This circle can be made up of a while loop too, like this:
variable name = int number, this is the circumference of the circle.
The test step which is variable name >= int number of variable name. This is the centre of the circle.
Increment step, or variable name ++
The centre is joined to the circumference by the increment step.
If there is a if statement within the while loop, this is put within the circle and if executed is equal to another point that the increment step joins to on it's way to the centre, inline with the center and circumference of the circle.
What my code does is it fills the circle from the circumference to the centre using the for loop.
The increment step goes from the first step which is on the circumference to the last step which is the centre of the circle.
What the increment step consists of is the variable names: one, two, etc.
The if statements go to a clip from the circumference to the centre, and they are only testing if the increment step they go to goes to is done in a random or linear order.
If it is done in a random order them it goes to clip two and equals clip one.
If it is done in a linear order it goes to clip two and stays at clip two.
http://thumbnails26.imagebam.com/12955/8e04f4129545060.jpg (http://www.imagebam.com/image/8e04f4129545060)
But, remember this is my imagination describing a language I don't really understand.
noee
25th April 2011, 21:07
I don't mean to troll and I mean this in a light-hearted way, but you have taken Rube Goldberg to the next level.
Instead of trying to abstract the code into some sort of description, why not just describe what you're trying to accomplish in simple language. Like:
"I want to loop thru a folder and create a random list of files from the folder and then play that list."
Jeremy Duncan
25th April 2011, 22:00
I'm going to join a video clip to each int variable. So int one is joined to video clip one. Joining the video clips is the "next" step, I'm not concerned with that right now.
Each video clip will have their own extra value of total number of frames, so "int one = video clip with x number of frames".
"Assuming" each int variable represents a video clip, I'm here to ask if the code works.
2 is always < 3 and 3 is always > 1. This means to be Random, I change this clip from; two equaling two, to two equalng one.
The list of for statements giving clips values is followed by a final for loop. This final for loop is supposed to play all the clips in the order they equal.
Zarxrax
25th April 2011, 22:09
Let's try this a different way.
Aside from whatever you are saying about the number of frames, what aspects of the previously posted python script dont meet your needs?
Groucho2004
25th April 2011, 22:20
Jeremy,
1. I still don't understand what you want to achieve (and I'm sure I'm not the only one).
2. The code you posted is, as noee aptly put it, equivalent to taking the Rube Goldberg machines to the next level.
3. If you really want to know what your bizarre code does - why don't you run it through the debugger yourself????
You have Visual Studio, you compiled the code, the next logical step is to see if it does what you intended.
-Vit-
25th April 2011, 22:27
JD, you don't understand even the most basic programming concepts. I suggest you spend time studying instead of writing posts to torture us.
This is a movie shuffler in an Avisynth script:
# Pick a number to give a different order
Order = 3436
# Push 7 clips onto an array called "Movies"
ArrayPush( "Movies", DirectShowSource("1.mp4") )
ArrayPush( "Movies", DirectShowSource("2.mp4") )
ArrayPush( "Movies", DirectShowSource("3.mp4") )
ArrayPush( "Movies", DirectShowSource("4.mp4") )
ArrayPush( "Movies", DirectShowSource("5.mp4") )
ArrayPush( "Movies", DirectShowSource("6.mp4") )
ArrayPush( "Movies", DirectShowSource("7.mp4") )
# Shuffle the 7 movies
Shuffle( "Movies", 7, Order ) # Leave the Order parameter out for a random order each second
# Pop and splice the randomly ordered movies from the array
ArrayPop("Movies") + \
ArrayPop("Movies") + \
ArrayPop("Movies") + \
ArrayPop("Movies") + \
ArrayPop("Movies") + \
ArrayPop("Movies") + \
ArrayPop("Movies")
# Randomly shuffle an array (see below) of given size
# Seed parameter can be given for specific shuffle, or omitted for
# a shuffle based on time of day (different shuffle each second)
function Shuffle( string Array, int Size, int "Seed")
{
rand = defined(Seed) ? Random(Seed) : Random()
swap = rand % Size
Size = Size - 1
a = ArrayGet( Array, Size )
b = ArrayGet( Array, swap )
ArraySet( Array, Size, b )
ArraySet( Array, swap, a )
(Size > 1) ? Shuffle( Array, Size, rand ) : NOP()
}
# Simple 16 bit random number generator, returns value 0 to 65535
# Pass last random number to seed next one. For initial seed pass user-chosen
# value or pass nothing to seed based on time of day (in seconds only)
function Random( int "Seed" )
{
Seed = default( Seed, Int(Value(Time("%S")) + 60 * (Value(Time("%M")) + 60 * Value(Time("%H")))) ) % 65536
return (seed * 26681 + 1) % 65536
}
# Simple array-like implementation with globals. No real error checking
function ArrayPush( string Array, val Value )
{
ArraySizeVar = Array + "Size"
index = 0
try { index = Eval( ArraySizeVar ) }
catch(e){ Eval( "global " + ArraySizeVar + "=0" ) }
Eval( "global " + Array + String(index) + "= Value" )
Eval( "global " + ArraySizeVar + "=" + ArraySizeVar + "+1" )
}
function ArrayPop( string Array )
{
ArraySizeVar = Array + "Size"
Eval( "global " + ArraySizeVar + "=" + ArraySizeVar + "-1" )
index = Eval( ArraySizeVar )
return Eval( Array + String(index) )
}
function ArraySet( string Array, int Index, val Value )
{
Eval( "global " + Array + String(index) + "= Value" )
}
function ArrayGet( string Array, int Index )
{
return Eval( Array + String(index) )
}
Jeremy Duncan
25th April 2011, 22:35
Let's try this a different way.
Aside from whatever you are saying about the number of frames, what aspects of the previously posted python script dont meet your needs?
I just opened the file and looked at the code and didn't see any boolean math for each clip.
So I said it's not what I was looking for. But, I would like to try it. Could you tell me how to load it into avsp and open the clips folder with avsp? :) I want to see how cool it looks. :cool:
Groucho2004,
Write how to run it through the debugger. I tried before but the debugger confused me.
-Vit-,
I will do that. No boolean math in there though. But not to worry.
Everyone; don't worry. I will go back to the C manual. No need to worry.
:thanks: :helpful:
I'm not trying to get a random movie shuffle. I'm trying to get the movie shuffle to be based on boolean true false, so it's predictable.
The goal is if it's based on boolean math not just a random unpredictable shuffle I can tweak the boolean math to create a shuffle that looks like a very good youtube movie hash.
I would like to know if it the math in post #15 does what I think it does? :) If not then point out the part of the code that is written wrong.
-Vit-
25th April 2011, 22:50
It would help if you read before you write. I put a comment on the Shuffle line about how to make a predictable random order. I have edited the post so it is even more clear. Just play with that Order number until you're happy.
Regarding your code in #15, it is wrong in so many ways that my head hurts.
My script uses the Fisher-Yates shuffle algorithm coupled with a Linear Congruential random number generator. Please go read.
Jeremy Duncan
25th April 2011, 22:57
Wow! Thanks -Vit-. I will definitely save that to a file and while I learn C I will reference this code to see how you did it. :)
Thank you very much.
Jeremy Duncan
25th April 2011, 23:38
-Vit-,
May I ask if there is a textbook on how to write that code? I asked in a different forum and they said it's not C or C++ but some varient. Do you have a link to a textbook on how to write that code? :)
Gavino
26th April 2011, 00:07
May I ask if there is a textbook on how to write that code? I asked in a different forum and they said it's not C or C++ but some varient. Do you have a link to a textbook on how to write that code? :)
Try this (http://avisynth.org/mediawiki/Main_Page#New_to_AviSynth_-_start_here).
Jeremy, you have excelled yourself with this thread.
I can only assume that you are a highly skilled troll who is having a good laugh at our expense.
Groucho2004
26th April 2011, 00:25
I can only assume that you are a highly skilled troll who is having a good laugh at our expense.
I don't think so. Looking at the stuff he posted it is clear that he is trying to invent some C/C++/Avisynth script hybrid plugin thingy, mixing everything together nicely. I think he's just confused and can't even recognize Avisynth scripts any more.
Gavino
26th April 2011, 01:27
Yeah, I was being ironic. ;)
I haven't seen C code like that since they stopped running the IOCCC (http://en.wikipedia.org/wiki/Obfuscated_C) (but those programs actually worked).
Jeremy Duncan
26th April 2011, 01:36
I know your upset right now, but I thought that if I put this out there I would get some information, so I asked.
I'm going to learn C before trying to learn C++ then trying avisynth stuff.
At the rate I learn it will take 3 years to learn c and c++ before I start into avisynth stuff. I googled the terms "arrayget", "arrayset" and got no guide. But then I tried get and set and pop as c++ terms and sure enough there they were.
Groucho2004
26th April 2011, 15:39
I googled the terms "arrayget", "arrayset" and got no guide. But then I tried get and set and pop as c++ terms and sure enough there they were.
Here's a hint:
What Vit posted is written in a script language that starts with an "A".
aegisofrime
26th April 2011, 16:41
Arrayget and arrayset are functions that Vit created; They aren't built in Avisynth functions, which is why you don't get anything with Google. I only took a crash course in pseudocode and even I know this...
Jeremy Duncan
26th April 2011, 21:14
Thanks to you people I have found a nice book to read on how to wite and code C.
After reading it a bit I found how I was writing the if and else code wrong before.
So I re-wrote the code fixing those errors and I also fixed to boolean math a bit so it's more random.
I hope you don't mind, but after doing all that I want to post the work I did.
:thanks:
If Gavino or -Vit- say it works, then may I ask somebody to make it into a avsi file or a py file so i can actually run it with real media files?
Here you go;
bad code removed
:helpful:
Groucho2004
26th April 2011, 21:46
Please stop cluttering the board with this insanity!
Your 300 lines long if-else monstrosity does nothing but assign different values to the variables. Once.
Your "code" makes no sense. Stop it.
Maybe you are trolling after all...
Also, if you think you need three years of learning programming to master this task you should possibly sit back and re-evaluate your goals.
Jeremy Duncan
26th April 2011, 22:03
:eek:Watch how loosely you sling around that T word, Groucho. :mad:
If the code I posted in my previous reply works or not is my first concern, then my second concern is if it acts as a randomizer as that is all it is.
If it makes sense to YOU is not my concern, right now. maybe later if this all works then we can post on the sensibility of the code.
Don't get spooked, Groucho. It's ok... :) I'm not Trolling, ok.
Guest
26th April 2011, 22:06
This is code/development related so can't remain in Avisynth Usage.
I can move it to Development or Newbies. The latter seems more appropriate given the content (e.g., "C" script and two=10), but let's be generous and choose the former.
Jeremy Duncan
26th April 2011, 22:09
Move it to development, since in the newbies forum I can't expect a newbie or newbie helper to help develop a plugin...can I?
Groucho2004
26th April 2011, 22:14
If it makes sense to YOU is not my concern
The question is if it makes sense to you. It sure doesn't make sense to anybody else.
Guest
26th April 2011, 22:17
Move it to development, since in the newbies forum I can't expect a newbie or newbie helper to help develop a plugin...can I? Your code does not appear to be a plugin. And Newbies is widely read, not only by Newbies. The Newbies forum gives you a little cover for deficiencies; in Development you may find things a bit more challenging. Experienced developers looking at your post are going to dismiss it anyway, I'm afraid.
E.g., all this one = 1 stuff. Do you know that you can index an array with a variable and eliminate all that error-prone repetition? If you grow to a thousand files, will you write thousands of lines of code, or will you choose a way that does it in a few lines? If you use an array, you can easily change the order by swapping array elements, etc.
Your way is absurd just from a usage perspective. If a user wants to work with a different number of files, he has to rewrite and recompile your tool?
Jeremy Duncan
26th April 2011, 22:31
You know if it should be in Newbies or not, I trust your judgement. So move it to newbies. I'm writing it now so later when I know C and C++ I have a foundation to go to too grow and develop more.
You know how code starts small and you do it right, then you add another section and you do that section right, then you add more code and you do that section right and when your all done your code is fancy. I'm doing it like that by starting with base code and then moving up to fancier code later.
Groucho. That circumference example is what I'm using. You wrote that 3 is always greater than 1 and 2 is always less than 3. This is "linear logic" (a term I just made up). That is the line to the centre of the circle is a straight line from the circumference to the centre.
That's not random.
So I say if that is true, that is linear logic is true, then randomize the sequence by making the variable random.
Or else, if the linear logic is false then there is no need to randomize the variable, so variable equals variable.
Guest
26th April 2011, 22:39
I'm doing it like that by starting with base code and then moving up to fancier code later. Great, that's the way to go.
My suggestion to you is that if you see something repeated a lot times with only a small variation, then it is probably an unrolled loop that you should roll up.
Good luck!
when your all done your code is fancy Hmm, a new idea for software quality metrics.
Gavino
26th April 2011, 22:51
If Gavino or -Vit- say it works, then may I ask somebody to make it into a avsi file or a py file so i can actually run it with real media files?
For heaven's sake Jeremy! Why are you continuing with this?
You seem unable to see that your program is complete and utter nonsense, and so is your explanation of it.
And C code cannot be turned into an avsi or py file.
Why can't you just use -Vit-'s script or Zarxrax's AvsP macro?
It's obvious you don't have the right skills to be a programmer (just as I'm not cut out to be a weightlifter).
You are enthusiastic and have a very unusual way of seeing things, perhaps you could be successfull in some sort of artistic activity. (Seriously.)
Jeremy Duncan
26th April 2011, 22:56
Gavino,
You didn't answer if the code works.
Gavino
26th April 2011, 22:59
I can't take any more, I give up!!!
Groucho2004
26th April 2011, 23:48
Groucho. That circumference example is what I'm using. You wrote that 3 is always greater than 1 and 2 is always less than 3. This is "linear logic" (a term I just made up). That is the line to the centre of the circle is a straight line from the circumference to the centre.
That's not random.
So I say if that is true, that is linear logic is true, then randomize the sequence by making the variable random.
Or else, if the linear logic is false then there is no need to randomize the variable, so variable equals variable.
Now it all makes sense. :rolleyes:
Jeremy Duncan
27th April 2011, 00:52
Your 300 lines long if-else monstrosity does nothing but assign different values to the variables. Once.
Here is a random code, I think that does more than the bug you mentioned:
bad code removed
:helpful:
-Vit-
27th April 2011, 01:38
Your code does not work. It doesn't randomize anything. It just reproduces the order that you manually type into the program.
Below is your code reproduced exactly, but with additional code to display the values in the variables 'one' to 'twenty-seven'.
To make sure you can see the text output, create a new project in Visual Studio of type "Win32 Console Application" (unless your project was already of that type).
Your for loop also counts one too far, corrupting memory and throwing a run-time error when you quit.
The output of the program is:
Contents of variables 'one' to 'twenty-seven':
1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 26 27
Press 'Return to quit
#include <iostream>
#include <stdio.h>
typedef struct movie {
int audio;
double fps;
} Movie;
int main( void )
{
Movie movies[27];
int one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twenty_one, twenty_two, twenty_three, twenty_four, twenty_five, twenty_six, twenty_seven;
one=1;
two=2;
three=3;
four=4;
five=5;
six=6;
seven=7;
eight=8;
nine=9;
ten=10;
eleven=11;
twelve=12;
thirteen=13;
fourteen=14;
fifteen=15;
sixteen=16;
seventeen=17;
eighteen=18;
nineteen=19;
twenty=20;
twenty_one=21;
twenty_two=22;
twenty_three=23;
twenty_four=24;
twenty_five=25;
twenty_six=26;
twenty_seven=27;
if((two<=three)&&(three>=one)&&(one=one)){
two=three;
}
else{
two=two;
}
/*break one*/
if((three<=four)&&(four>=two)&&(two=two)){
three=four;
}
else{
three=three;
}
/*break two*/
if((four<=five)&&(five>=three)&&(three=three)){
four=five;
}
else{
four=four;
}
/*break three*/
if((five<=six)&&(six>=four)&&(four=four)){
five=six;
}
else{
five=five;
}
/*break four*/
if((six<=seven)&&(seven>=five)&&(five=five)){
six=seven;
}
else{
six=six;
}
/*break five*/
if((seven<=eight)&&(eight>=six)&&(six=six)){
seven=eight;
}
else{
seven=seven;
}
/*break six*/
if((eight<=nine)&&(nine>=seven)&&(seven=seven)){
eight=nine;
}
else{
eight=eight;
}
/*break seven*/
if((nine<=ten)&&(ten>=eight)&&(eight=eight)){
nine=ten;
}
else{
nine=nine;
}
/*break eight*/
if((ten<=eleven)&&(eleven>=nine)&&(nine=nine)){
ten=eleven;
}
else{
ten=ten;
}
/*break nine*/
if((eleven<=twelve)&&(twelve>=ten)&&(ten=ten)){
eleven=twelve;
}
else{
eleven=eleven;
}
/*break ten*/
if((twelve<=thirteen)&&(thirteen>=eleven)&&(eleven=eleven)){
twelve=thirteen;
}
else{
twelve=twelve;
}
/*break eleven*/
if((thirteen<=fourteen)&&(fourteen>=twelve)&&(twelve=twelve)){
thirteen=fourteen;
}
else{
thirteen=thirteen;
}
/*break twelve*/
if((fourteen<=fifteen)&&(fifteen>=thirteen)&&(thirteen=thirteen)){
fourteen=fifteen;
}
else{
fourteen=fourteen;
}
/*break thirteen*/
if((fifteen<=sixteen)&&(sixteen>=fourteen)&&(fourteen=fourteen)){
fifteen=sixteen;
}
else{
fifteen=fifteen;
}
/*break fourteen*/
if((sixteen<=seventeen)&&(seventeen>=fifteen)&&(fifteen=fifteen)){
sixteen=seventeen;
}
else{
sixteen=sixteen;
}
/*break fifteen*/
if((seventeen<=eighteen)&&(eighteen>=sixteen)&&(sixteen=sixteen)){
seventeen=eighteen;
}
else{
seventeen=seventeen;
}
/*break sixteen*/
if((eighteen<=nineteen)&&(nineteen>=seventeen)&&(seventeen=seventeen)){
eighteen=nineteen;
}
else{
eighteen=eighteen;
}
/*break seventeen*/
if((nineteen<=twenty)&&(twenty>=eighteen)&&(eighteen=eighteen)){
nineteen=twenty;
}
else{
nineteen=nineteen;
}
/*break eighteen*/
if((twenty<=twenty_one)&&(twenty_one>=nineteen)&&(nineteen=nineteen)){
twenty=twenty_one;
}
else{
twenty=twenty;
}
/*break nineteen*/
if((twenty_one<=twenty_two)&&(twenty_two>=twenty)&&(twenty=twenty)){
twenty_one=twenty_two;
}
else{
twenty_one=twenty_one;
}
/*break twenty*/
if((twenty_two<=twenty_three)&&(twenty_three>=twenty_one)&&(twenty_one=twenty_one)){
twenty_two=twenty_three;
}
else{
twenty_two=twenty_two;
}
/*break twenty_one*/
if((twenty_three<=twenty_four)&&(twenty_four>=twenty_two)&&(twenty_two=twenty_two)){
twenty_three=twenty_four;
}
else{
twenty_three=twenty_three;
}
/*break twenty_two*/
if((twenty_four<=twenty_five)&&(twenty_five>=twenty_three)&&(twenty_three=twenty_three)){
twenty_four=twenty_five;
}
else{
twenty_four=twenty_four;
}
/*break twenty_three*/
if((twenty_five<=twenty_six)&&(twenty_six>=twenty_four)&&(twenty_four=twenty_four)){
twenty_five=twenty_six;
}
else{
twenty_five=twenty_five;
}
/*break twenty_five*/
// Output the contents of the variables
std::cout << "Contents of variables 'one' to 'twenty-seven':" << std::endl;
std::cout << one << " "
<< two << " "
<< three << " "
<< four << " "
<< five << " "
<< six << " "
<< seven << " "
<< eight << " "
<< nine << " "
<< ten << " "
<< eleven << " "
<< twelve << " "
<< thirteen << " "
<< fourteen << " "
<< fifteen << " "
<< sixteen << " "
<< seventeen << " "
<< eighteen << " "
<< nineteen << " "
<< twenty << " "
<< twenty_one << " "
<< twenty_two << " "
<< twenty_three << " "
<< twenty_four << " "
<< twenty_five << " "
<< twenty_six << " "
<< twenty_seven << std::endl << std::endl;
for ( one = 1; one <= twenty_seven; ++one ) {
/* the name of the movie file corresponds to the array element
* e.g. movie "5.mp4" is movies[5], movie "6.mp4" is movies[6]...
*/
movies[one].audio = 0;
movies[one].fps = 23.976;
}
std::cout << "Press 'Return' to quit" << std::endl;
std::cin.get();
return 0;
}
Guest
27th April 2011, 01:39
It's fancy now, so we are done.
BTW, a random shuffle can be done in a few lines, e.g.:
http://rgrig.blogspot.com/2005/04/random-permutation.html
-Vit-
27th April 2011, 01:51
Which is the same algorithm as the Fisher-Yates shuffle I used (http://forum.doom9.org/showthread.php?p=1495575#post1495575) earlier, although this one is 1-based, and I made mine recursive to suit Avisynth.
Guest
27th April 2011, 01:55
You didn't tell him all his else clauses are superfluous. :)
else{
twenty_one=twenty_one;
}
is a no-op.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.