View Full Version : Array Rotation Script
I was hoping someone could whip up a small script in javascipt or php for me. It will have 3-5 array of words and output all possible combinations of those words that I can copy/paste into my text editor and take the good ones for use in my TGSW descriptions. :)
Relic
08-15-2002, 03:25 PM
I could do that, only problem is that it would generate duplicates.
TeenGodFather
08-15-2002, 03:27 PM
I think I've seem something like that on some TGP's that use javascript. :)
Not sure if you ment that..
like: one noun, one verb etc...
I don't have one at hand, but it shouldn't be hard to make.. it would be completely random though
AgentCash
08-15-2002, 03:34 PM
I'll do it. Gimmie a few.
Originally posted by AgentCash
I'll do it. Gimmie a few.
You da' man. :D
AgentCash
08-15-2002, 05:29 PM
Well shit this is the easiest thing I could come up with...
<script>
var words = new Array(
"sexy",
"amateur",
"bitch",
"hot",
"fuck",
"slut",
"eat",
"pussy"
);
var num = words.length;
for (var e=0; e<num; e++) {
for (var d=0; d<num; d++) {
for (var c=0; c <num; c++) {
for (var b=0; b<num; b++) {
for (var a=0; a<num; a++) {
if(a == b || a == c || a == d || a == e || b == c || b == d || b == e || c == d || c == e || d ==e){}else{
document.write(words[e] +" "+ words[d] +" "+ words[c] +" "+ words[b] +" "+ words[a] + '<br>');}
}
}
}
}
}
</script>
IE throws a warning that the script is causing it to run slowly, just click "Yes" to continue running the script.
That's sorta what I have in mind, but I need different arrays and cycle the words in each array instead of moving their positions.
ie:
array[1]: pretty, beautiful, nice, hot
array[2]: sultry, tan, naked, wacked
array[3]: girl, lady, babe, vixen
then outputs:
pretty sultry girl
pretty sultry lady
pretty sultry babe
pretty sultry vixen
pretty tan girl
pretty tan lady
...
hot sultry girl
hot sultry lady
hot sultry babe
...
etc
sorta like dice... :)
Relic
08-15-2002, 06:05 PM
Originally posted by GFED
sultry
This wouldn't be a gay site now would it :p
AgentCash
08-15-2002, 06:13 PM
Well that's a lot easier :)
<script>
var one = new Array(
"pretty",
"beautiful",
"nice",
"hot"
);
var two = new Array(
"sultry",
"tan",
"naked",
"wacked"
);
var three = new Array(
"girl",
"lady",
"babe",
"vixen"
);
for(a=0;a<one.length;a++){
for(b=0;b<two.length;b++){
for(c=0;c<three.length;c++){
document.write(one[a] + " " + two[b] + " " + three[c] + "<br>");
}}}
</script>
Perrrfect! Thanks bro! :D
AgentCash
08-15-2002, 08:56 PM
Upgraded it a bit... now you can limit the number of characters to
30 and use four arrays of words to better match the TGSW
description system.
<script>
var lt = 1; // Character limit on or off (1 = on, 0 = off)
var tl = 30; // Number of characters to allow (only works when above is set to 1)
var one = new Array(
"pretty",
"beautiful",
"nice",
"hot"
);
var two = new Array(
"sultry",
"tan",
"naked",
"wacked",
"amazing"
);
var three = new Array(
"girl",
"lady",
"babe",
"vixen",
"shishkabober"
);
var four = new Array(
"blah",
"heh"
);
var dupes = new Array();
for(a=0;a<one.length;a++){
for(b=0;b<two.length;b++){
for(c=0;c<three.length;c++){
for(d=0;d<four.length;d++){
var line = one[a] + " " + two[b] + " " + three[c] + " " + four[d];
var ll = line.length;
if(lt){
if(ll > tl){ line = one[a] + " " + two[b] + " " + three[c]; ll = line.length;
if(ll > tl){ line = one[a] + " " + two[b]; ll = line.length;
if(ll > tl){ line = one[a]; }}}}
dupes[line] = line;
}}}}
for (var k in dupes) {
document.write(dupes[k]+"<br>");
}
</script>
Ahhh... even better! Thanks again AgentCash! :D
vBulletin® v3.7.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.