Code viewer for World: Chess With mind no p5

// Cloned by Mathias Bazin on 27 Jul 2018 from World "Chess With mind 2 with p5 ( does not work )" by Mathias Bazin 
// Please leave this clone trail here.
 


// Cloned by Mathias Bazin on 27 Jul 2018 from World "Chess With mind" by Mathias Bazin 
// Please leave this clone trail here.
 


// Cloned by Mathias Bazin on 26 Jul 2018 from World "Chess" by Mathias Bazin 
// Please leave this clone trail here.
 
AB.runReady      = false;


let s = document.createElement("script");
s.src = "https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.10.2/chess.js";                          
s.onload = function() { 
    console.log("chess loaded");
    
    AB.runReady = true;
};        // function to be called when JS is loaded
document.head.appendChild(s);  



AB.clockTick = 100;



function World() 
{ 
    
    let chess;
    let scl = 40;
    let xoff = 250;
    let yoff = 300;
    
    
	this.newRun = function()
	{
	    threeworld.init (  "white"  ); 
	    chess = new Chess();
	};
	
	this.getState = function()
	{
	    return chess.fen();
	}
	
	this.takeAction = function(a)
	{
	     if (!chess.game_over())
        {

            if(chess.turn() == 'w')
            {
                chess.move(a);
            }
            else //Black player makes his move
            {
                let moves = chess.moves();
                let move = moves[Math.floor(Math.random() * moves.length)];
                chess.move(move);
            }
            
            $("#user_span1").html(chess.ascii());
            $("#user_span2").html("<p>See better in console</p>");
            console.log(chess.ascii());
        }
        else 
        {
            console.log("Game Over");
        }
	}
	

}