js-combinatorics
Version:
Simple combinatorics like power set, combination, and permutation in JavaScript
47 lines (46 loc) • 1.63 kB
HTML
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://unpkg.com/mocha/mocha.css" />
<script src="https://cdn.rawgit.com/jquery/jquery/3.4.0/dist/jquery.min.js">></script>
<script src="https://unpkg.com/mocha/mocha.js"></script>
<script>
mocha.setup('bdd');
</script>
<script src="../combinatorics.js"></script>
<script>
var assert = function(expr, msg) {
if (!expr) throw new Error(msg || 'failed');
};
assert.equal = function(a, b, msg) {
if (a !== b) throw new Error(msg || ('failed : '+a+','+b));
};
assert.throws = function(expr, etype) {
var err;
try {
expr();
} catch(e) {
if (e instanceof etype) return;
}
throw new Error("did not throw " + etype);
}
</script>
<script src="./C.js"></script>
<script src="./P.js"></script>
<script src="./baseN.js"></script>
<script src="./cartesianproduct.js"></script>
<script src="./combination.js"></script>
<script src="./permutation.js"></script>
<script src="./permutationCombination.js"></script>
<script src="./power.js"></script>
<script>
$(function() {
mocha.run();
});
</script>
</head>
<body>
$Id: browser.html,v 0.2 2013/03/09 00:46:33 dankogai Exp dankogai $
<div id="mocha"></div>
</body>
</html>