Skip to content

Instantly share code, notes, and snippets.

@Leask
Created October 8, 2013 06:30
Show Gist options
  • Select an option

  • Save Leask/6880388 to your computer and use it in GitHub Desktop.

Select an option

Save Leask/6880388 to your computer and use it in GitHub Desktop.
Exhaustive all cases of filling A, B, C, D in to a ten elements array.
function output(intIn) {
strIn = intIn.toString(4);
var aL = ['A', 'B', 'C', 'D'];
var msk = '0000000000';
var len = msk.length;
var str = msk + strIn;
var rtn = '';
str = str.substr(str.length - len, len);
arr = str.split('');
for (var i in arr) {
rtn += aL[arr[i]];
}
console.log(rtn);
}
var max = Math.pow(4, 10);
for (var i = 0; i < max; i++) {
output(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment