<commit_before>battleship.controller("battleController", function($scope, $routeParams, io) {
	// Get the unique game ID
	var gameId = $routeParams.gameId;

	// Get the socket and then join the game
	var socket = io('/battle');
	socket.emit('join', gameId);

	// Socket events
	socket.on('disconnect', function() {
		// TODO display to the user that we have been disconnected from the server
		console.log('Disconnected', arguments);
	});
	socket.on('join', function(gameData) {
		// Server has acknowledged that we joined the game, update the game data with the current data from the server
		// TODO
		console.log(gameData);
		if (gameData.game) {
			$scope.players = [{
				name: gameData.game.player1,
				status: 'Unknown'
			}];
			if (gameData.game.player2) {
				$scope.players.push({
					name: gameData.game.player2,
					status: 'Unknown'
				});
			}
		}
	});
	socket.on('rejoin', function() {
		// Rejoin the game, this typically only happens if the server was restarted
		socket.emit('join', gameId)
	});
	socket.on('fire-shot', function(shotData) {
		console.log(shotData);
		if (shotData.hit) {
			// Do hit
			$scope.enemyBoardSchema[shotData.coords].type = "hit";
			document.getElementById('E' + shotData.coords).style.background = "red";
		} else {
			// Do miss
			$scope.enemyBoardSchema[shotData.coords].type = "miss";
			document.getElementById('E' + shotData.coords).style.background = "grey";
		}

		$scope.endTurn();
	});
	socket.on('setup-ready', function(setupState) {
		console.log(setupState);
	});

	$scope.test = "color: red";
	$scope.gameStatus = "Setup";
	$scope.currentSelectedShip = "none";
	$scope.currentShipOrientation = "none";
	$scope.currentShipLength = 0;
	$scope.selectedCells = [];
	$scope.myPlayer = "1";
	$scope.players = [];

	$scope.cellHover = function(e) {
		if ($scope.gameStatus == "Setup" && $scope.currentSelectedShip != "none") {
			$scope.test = "color: blue";
			//console.dir(e);
			var id = e.target.id;
			var cellCoords = id.substr(1, 2);
			cellCoords = parseInt(cellCoords);
			//console.log("_____" + cellCoords);
			$scope.populateArray(cellCoords);
			//console.log("_____" + cellCoords);
			if ($scope.canPlaceShip(cellCoords)) {
				for(var i = 0; i < $scope.selectedCells.length; i++) {
					var id = $scope.stringifyCoords($scope.selectedCells[i]);
					document.getElementById(id).style.background = "green";
				}<commit_msg>setup status<commit_after>battleship.controller("battleController", function($scope, $routeParams, io) {
	// Get the unique game ID
	var gameId = $routeParams.gameId;

	// Get the socket and then join the game
	var socket = io('/battle');
	socket.emit('join', gameId);

	// Socket events
	socket.on('disconnect', function() {
		// TODO display to the user that we have been disconnected from the server
		console.log('Disconnected', arguments);
	});
	socket.on('join', function(gameData) {
		// Server has acknowledged that we joined the game, update the game data with the current data from the server
		// TODO
		console.log(gameData);
		if (gameData.game) {
			$scope.players = [{
				name: gameData.game.player1,
				status: 'Unknown'
			}];
			if (gameData.game.player2) {
				$scope.players.push({
					name: gameData.game.player2,
					status: 'Unknown'
				});
			}
		}
	});
	socket.on('rejoin', function() {
		// Rejoin the game, this typically only happens if the server was restarted
		socket.emit('join', gameId)
	});
	socket.on('fire-shot', function(shotData) {
		console.log(shotData);
		if (shotData.hit) {
			// Do hit
			$scope.enemyBoardSchema[shotData.coords].type = "hit";
			document.getElementById('E' + shotData.coords).style.background = "red";
		} else {
			// Do miss
			$scope.enemyBoardSchema[shotData.coords].type = "miss";
			document.getElementById('E' + shotData.coords).style.background = "grey";
		}

		$scope.endTurn();
	});
	socket.on('setup-ready', function(setupState) {
		console.log(setupState);
        $scope.gameStatus = setupState.gameStatus;
	});

	$scope.test = "color: red";
	$scope.gameStatus = "Setup";
	$scope.currentSelectedShip = "none";
	$scope.currentShipOrientation = "none";
	$scope.currentShipLength = 0;
	$scope.selectedCells = [];
	$scope.myPlayer = "1";
	$scope.players = [];

	$scope.cellHover = function(e) {
		if ($scope.gameStatus == "Setup" && $scope.currentSelectedShip != "none") {
			$scope.test = "color: blue";
			//console.dir(e);
			var id = e.target.id;
			var cellCoords = id.substr(1, 2);
			cellCoords = parseInt(cellCoords);
			//console.log("_____" + cellCoords);
			$scope.populateArray(cellCoords);
			//console.log("_____" + cellCoords);
			if ($scope.canPlaceShip(cellCoords)) {
				for(var i = 0; i < $scope.selectedCells.length; i++) {
					var id = $scope.stringifyCoords($scope.selectedCells[i]);
					document.getElementById(id).style.background = "green";
				}
{'fraction_non_alphanumeric': 0.16316006600660066, 'fraction_numerical': 0.0033003300330033004, 'mean_word_length': 3.7962413452027697, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5441785', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1622, 'n_words': 351}