<commit_before>var highlighted = [];
function highlightMoves(x,y)
{
	if(highlighted.length==0)
	{
		var moves = availableMoves['x'+x+'y'+y];
		if(moves != null)
		{
			for(var i=0; i < moves.length; i++)
			{
				ele = document.getElementById('x'+moves[i].x+'y'+moves[i].y);
				highlighted.push({"ele":ele,"x":moves[i].x,"y":moves[i].y});
				ele.onclick = 'submitMove('+x+','+y+','+moves[i].x+','+moves[i].y+');';
				ele.innerHTML = ele.innerHTML + 'X'; 
			}
		}
	}
	else
	{
		unhighlightMoves();
	}
}
function unhighlightMoves()
{
	var h;
	while(h = highlighted.pop())
	{
		h.ele.innerHTML = h.ele.innerHTML.replace('X','');
		h.ele.onclick = 'highlightMoves('+h.x+','+h.y+');';
	}
}

function getTextElem(ele,name)
{
	return ele.getElementsByTagName(name)[0].textContent;
}

function submitMove(x,y,toX,toY)
{
	var xmlHttp = getXmlHttpObject();
	xmlHttp.open('GET',submitMoveHREF+'&x='+x+'&y='+y+'&toX='+toX+'&toY='+toY,true);
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4&&xmlHttp.responseXML)
		{
			updateGameCallback(xmlHttp.responseXML);
		}
	};
	xmlHttp.send(null);
	
}<commit_msg>Use a function rather than string.<commit_after>var highlighted = [];
function highlightMoves(x,y)
{
	if(highlighted.length==0)
	{
		var moves = availableMoves['x'+x+'y'+y];
		if(moves != null)
		{
			for(var i=0; i < moves.length; i++)
			{
				ele = document.getElementById('x'+moves[i].x+'y'+moves[i].y);
				highlighted.push({"ele":ele,"x":moves[i].x,"y":moves[i].y});
				ele.onclick = (function(x,y){return function(){submitMove(x,y,toX,toY);}})(x,y, moves[i].x, moves[i].y);
				ele.innerHTML = ele.innerHTML + 'X'; 
			}
		}
	}
	else
	{
		unhighlightMoves();
	}
}
function unhighlightMoves()
{
	var h;
	while(h = highlighted.pop())
	{
		h.ele.innerHTML = h.ele.innerHTML.replace('X','');
		h.ele.onclick = (function(x,y){return function(){highlightMoves('+x+','+y+')}})(h.x,h.y);
	}
}

function getTextElem(ele,name)
{
	return ele.getElementsByTagName(name)[0].textContent;
}

function submitMove(x,y,toX,toY)
{
	var xmlHttp = getXmlHttpObject();
	xmlHttp.open('GET',submitMoveHREF+'&x='+x+'&y='+y+'&toX='+toX+'&toY='+toY,true);
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4&&xmlHttp.responseXML)
		{
			updateGameCallback(xmlHttp.responseXML);
		}
	};
	xmlHttp.send(null);
	
}
{'fraction_non_alphanumeric': 0.22805507745266781, 'fraction_numerical': 0.0034423407917383822, 'mean_word_length': 5.1345646437994725, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7204173', 'n_tokens_mistral': 1048, 'n_tokens_neox': 984, 'n_words': 107}