Android Math Puzzle test

by Laurens Maneschijn

HTML

<h1>Solver for "Math Puzzle" game on android</h1>

<form class="floatleft box">
  <label><input type="text" id="input_tokens" value="+ - * / " placeholder="" title="Enter available tokens"> tokens</label>
  e.g. : <code>+ - * / 10 3 7 1</code>
  <br>
  <label><input type="text" id="input_targets" value="" placeholder="" title="Enter target values. This will filter results on only those target values. Leave empty to show all."> targets</label>
  e.g. : <code>5 0 -11 59 12</code>
  <br>
  <label><input type="checkbox" checked id="input_sort_by_result" title="sort results by result value (might take a bit longer)"></label>
  <input type="submit"> <input type="reset" value="clear"> <a href="#" id="example">example</a>
</form>

<p class="description floatleft box">
	Tokens: operators and numbers. Seperate with spaces.<br>
	- Enter operators like: <code>+ - * /</code>. Use <code>*</code> for multiply (&#10006;), and <code>/</code> for division (&divide;).<br>
	- Enter numbers as simple integers; e.g. &radic;9 as <code>3</code>.<br>
	<br>
	Targets: Optional. Filter results on these numbers. Leave blank to show all permutations.<br>
</p>

<div class="floatright">
	<a target="_blank" href="https://fiddle.jshell.net/ElMoonLite/6Lyjn7pa/show/?editor_console=">fullscreen 1</a><br>
	<a target="_blank" href="https://jsfiddle.net/ElMoonLite/6Lyjn7pa/show/?editor_console=">fullscreen 2</a><br>
	<a target="_blank" href="https://play.google.com/store/apps/details?id=com.nfarima.cellsevo">Math Puzzle on Google Play</a><br>
</div>

<hr class="clearfloat">

<div id="result"></div>

CSS

h1,h2,h3,h4,h5,h6,p {
	margin: 1px 0;
	font-size: initial;
}


.box {
	display: inline-block;
	margin: 2px;
	padding: 2px;
	border-radius: 5px;
	border: 1px solid #888;
	background: #8882;
}

code {
	display: inline-block;
	padding: 1px;
	margin: 1px;
	background: #8882;
	border: 1px dotted #8888;
	user-select: all;
	user-select: contain;
}

.floatleft {
	display: inline-block;
	float: left;
}

.floatright {
	display: inline-block;
	float: right;
}
.clearfloat {
	clear: both;
}

.description {
	line-height: 1;
	font-size: 14px;
}

.block, .line {
	display: block;
}
.inlineblock {
	display: inline-block;
}

.screen {
	display: inline-block;
	
}

.targets {
	display: inline-block;
	border: 1px solid #888;
	border-radius: 5px;
	margin: 2px;
	min-height: 1.5em;
	min-width: 120px;
}
.targetbit {
	display: inline-block;
	min-width: 1em;
	min-height: 1em;
	line-height: 1;
	text-align: center;
	border: 1px solid #888;
	border-radius: calc(100%);
	background: #8882;
	padding: 2px;
	margin: 2px;
}

.wheel {
	height: 120px;
	width: 120px;
	border: 1px solid #888;
	border-radius: calc(100%);
	background: #8881;
	margin: 2px;
}

.bit {
	height: 1em;
	width: 1em;
	line-height: 1;
	text-align: center;
	border: 1px solid #888;
	border-radius: calc(100%);
	background: #8882;
	margin-left: -0.5em;
	margin-top: -0.5em;
}

JavaScript

//////////
// jsfiddle jquery loading seems broken, so copy paste minimized version for now:
//////////

/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return...