JSFiddle - React, Tailwind, and code Playground

by Ace Tributon

HTML

<h3>
This is my bot playground!!! <br />
use any keys or 'bet' at your disposal!
</h3>

<div id='demo'>
    This is a test of randomBot
</div>
<button id='click'>
Lets get some cash!  bet 1000?
</button>
Press F12 if youre on desktop!<br />
<!--<button id='library'>
Check log for passed and failed keys!
</button>-->
<table>
<tr><td>Key:</td><td id="key"></td></tr>
<tr><td>Key Code:</td><td id="keyCode"></td></tr>
<tr><td>Event Code:</td><td id="eventCode"></td></tr>
<!--<tr><td>Input: <input id='inputs' type='text' value='please type here' /></td></tr>--></table>
<script type="text/javascript">
window.addEventListener("keydown", e => {
  //tested in IE/Chrome/Firefox
  document.getElementById("key").innerHTML = e.key ;
  document.getElementById("keyCode").innerHTML = e.keyCode ;
  document.getElementById("eventCode").innerHTML = e.code ;
  
  var keys=()=>(Math.floor(65+Math.random()*26)===e.keyCode) ? console.log('hello: '+e.key): console.log('goodbye: ' + e.key)+(Math.floor(65+Math.random()*26)===e.keyCode)?console.log('keys match!'):console.log('keys dont match, chief!'); keys();
});

var bank=0;

document.getElementById('click').onclick=()=>
console.log('Lets begin Shall we?')+
[0,()=>Math.floor((Math.random()*250)+150),(num)=>Math.floor(Math.random()*num),function(num,set=6){
(num!=0)?console.log('Its a 6! here is your money...')+(this[0]+=this[1]())+this[3](this[2](set)):
(num===0)?console.log('its a 0! your last deposit is here! checking out...')+this[3]('stop'):
(num==='stop')?((this[0]>=1000)?console.log(`your program has stopped....  You've recieved ${this[0]-1000}! :D`)+(bank+=this[0]-1000):console.log(`your program has stopped....  You've lost ${(this[0]-1000)*-1}! :(`)+(bank+=this[0]-1000)):
console.log('it broke harder');return this;}][3](Math.floor(Math.random()*6),6)+console.log(bank);

</script>

JavaScript

[0,()=>Math.floor((Math.random()*250)+150),(num)=>Math.floor(Math.random()*num),function(num,set=6){
for(i=0;i<set+1;i++){
return (num===i)?console.log(`Its a ${i}! here is your money...`)+(this[0]+=this[1]())+this[3](this[2](set)):
  (num===0)?console.log('its a 0! your last deposit is here! checking out...')+this[3]('stop'):
  (num==='stop')?((this[0]>=1000)?console.log(`your program has stopped....  You've recieved ${this[0]-1000}! :D`):console.log(`your program has stopped....  You've lost ${(this[0]-1000)*-1}! :(`)):console.log('it broke harder');
};
return this;}][3](Math.floor(Math.random()*6),6);