<commit_before>'use strict';

const path = require('path');
const express = require('express');
const app = require('express')();
const http = require('http').Server(app);
const io = require('socket.io')(http);

import * as constant from '../client/js/constant';
import Board from '../client/js/board.js';

var b = new Board();

app.use(express.static(path.join(__dirname, '..', 'client')));

app.get('/', (req, res) => {
	res.sendFile(__dirname + '/index.html');
});

io.on('connection', function(socket) {

	io.emit('client ID', socket.id);
	io.emit('connect message');

	socket.on('movement', event => {
		io.emit('movement', event);
	});

	socket.on('disconnect', function() {
		io.emit('disconnect message');
	});

	socket.on('appleEaten', position => {
		b.apples.forEach((apple, index) => {
			if(apple.x === position.x && apple.y === position.y){
				b.apples.splice(index, 1);
			}
		});
	});
	socket.on('changeDirection', (data) => {
		io.emit('setDirection', data);
	});
});

setInterval(function() {
	io.emit('start', 'Démarrage de la partie');

	while(b.apples.length < constant.DEFAULT_APPLES_NUMBER){
		let apple = b.generateApple();
		io.emit('new_apple', apple);
	}

	setTimeout(function() {
		io.emit('end', 'Fin de la partie');
	}, constant.GAME_DURATION);
}, constant.TOTAL_DURATION);

http.listen(3000, () => {
	console.log('listening on *:3000');
});<commit_msg>Repop des pommes !<commit_after>'use strict';

const path = require('path');
const express = require('express');
const app = require('express')();
const http = require('http').Server(app);
const io = require('socket.io')(http);

import * as constant from '../client/js/constant';
import Board from '../client/js/board.js';

var b = new Board();

app.use(express.static(path.join(__dirname, '..', 'client')));

app.get('/', (req, res) => {
	res.sendFile(__dirname + '/index.html');
});

io.on('connection', function(socket) {

	io.emit('client ID', socket.id);
	io.emit('connect message');

	socket.on('movement', event => {
		io.emit('movement', event);
	});

	socket.on('disconnect', function() {
		io.emit('disconnect message');
	});

	socket.on('appleEaten', position => {
		b.apples.forEach((apple, index) => {
			if(apple.x === position.x && apple.y === position.y){
				b.apples.splice(index, 1);
			}
		});
	});
	
	socket.on('changeDirection', (data) => {
		io.emit('setDirection', data);
	});
});

setInterval(function() {
	io.emit('start', 'Démarrage de la partie');

	while(b.apples.length < constant.DEFAULT_APPLES_NUMBER){
		let apple = b.generateApple();
		io.emit('new_apple', apple);
	}

	setTimeout(function() {
		io.emit('end', 'Fin de la partie');
	}, constant.GAME_DURATION);
}, constant.TOTAL_DURATION);

http.listen(3000, () => {
	console.log('listening on *:3000');
});
{'fraction_non_alphanumeric': 0.22234234234234235, 'fraction_numerical': 0.006486486486486486, 'mean_word_length': 4.642276422764228, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '570206', 'n_tokens_mistral': 1024, 'n_tokens_neox': 967, 'n_words': 185}