
previous

page 5
next
more on repetition
If we shuffle the countries array before looking for a country starting with A (for example), we won't always get ALBANIA.
But it's not that simple because we are working through all the countries one by one - shuffling will really mess that up!
The answer is to duplicate the countries array.
<script>
var countries0=[];
for (var i=0;i<countries.length;i++) {
countries0[i]=countries[i];
}
for (var i=0;i<countries.length;i++) {
var c0=countries0[i];
var letters=c0.split('');
var arr=[];
for (var j=0;j<letters.length;j++) {
var l=letters[j];
Shuffle(countries);
for (k=0;k<countries.length;k++) {
var countries0=[];
for (var i=0;i<countries.length;i++) {
countries0[i]=countries[i];
}
for (var i=0;i<countries.length;i++) {
var c0=countries0[i];
var letters=c0.split('');
var arr=[];
for (var j=0;j<letters.length;j++) {
var l=letters[j];
Shuffle(countries);
for (k=0;k<countries.length;k++) {
I ended up with 108 sets.
You need to copy and paste them into Atom, edit it to look like mine and then save as g_sets.js.
var g_sets=[
['ALGERIA','LATVIA','BENIN','AUSTRALIA','NICARAGUA',
'INDIA','ARMENIA'],
...
['ZAIRE','ARGENTINA','MADAGASCAR','BURMA','IRELAND',
'ALGERIA']
];
['ALGERIA','LATVIA','BENIN','AUSTRALIA','NICARAGUA',
'INDIA','ARMENIA'],
...
['ZAIRE','ARGENTINA','MADAGASCAR','BURMA','IRELAND',
'ALGERIA']
];
previous
next