<commit_before>var log4js = require('log4js');
log4js.configure('log4js_config.json');
var logger = log4js.getLogger('cheese');

var express = require('express');
var app = express();
app.use(log4js.connectLogger(logger, { level: log4js.levels.INFO }));
app.use(express.static(__dirname + '/public'));
app.get('/', function(req, res){
  res.sendFile(__dirname + '/index.html');
});

var http = require('http').Server(app);
var io = require('socket.io')(http);
http.listen(3000, function(){
  logger.info('listening on *:3000');
});

var World = require('./world');
var world = new World();
io.on('connection', function(socket){
  var player = world.login(socket.id);
  //プレイヤーを追加
  Object.keys(world.players).forEach(function(id){
    io.sockets.emit('new_player', world.players[id].id);
  });
  socket.on('disconnect', function(){
    logger.info('disconnect ' + socket.id);
    world.logout(socket.id);
    io.sockets.emit('leave_player', socket.id);
  });
  socket.on('key', function(data){
    player.updateKey(data.key, data.state);
  });
  socket.on('start', function(){
    //メインループの開始
    //world.init();
    world.done = false;
    world.start(function(worldState){
      //io.sockets.emit('update', worldState);
      logger.info(worldState);
      if(!worldState.done) {
        //じゃんけんポンの掛け声
        io.sockets.emit('call', worldState);
      } else {
        //じゃんけんの結果
        io.sockets.emit('result', worldState.players);
        
      }
    });
  });
  socket.on('te', function(te) {
    logger.trace(te);
    player.updateTe(te);
  });
});


<commit_msg>Revert "refactor start-up sequence"<commit_after>var express = require('express');
var log4js = require('log4js');
log4js.configure('log4js_config.json');
var logger = log4js.getLogger('cheese');

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

var async = require('async');

app.use(express.static(__dirname + '/public'));

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

//http.configure(function() {
  app.use(log4js.connectLogger(logger, { level: log4js.levels.INFO }));
//});

http.listen(3000, function(){
  logger.info('listening on *:3000');
});

var World = require('./world');
var world = new World();
io.on('connection', function(socket){
  var player = world.login(socket.id);
  //プレイヤーを追加
  Object.keys(world.players).forEach(function(id){
    io.sockets.emit('new_player', world.players[id].id);
  });
  socket.on('disconnect', function(){
    logger.info('disconnect ' + socket.id);
    world.logout(socket.id);
    io.sockets.emit('leave_player', socket.id);
  });
  socket.on('key', function(data){
    player.updateKey(data.key, data.state);
  });
  socket.on('start', function(){
    //メインループの開始
    //world.init();
    world.done = false;
    world.start(function(worldState){
      //io.sockets.emit('update', worldState);
      logger.info(worldState);
      if(!worldState.done) {
        //じゃんけんポンの掛け声
        io.sockets.emit('call', worldState);
      } else {
        //じゃんけんの結果
        io.sockets.emit('result', worldState.players);
        
      }
    });
  });
  socket.on('te', function(te) {
    logger.trace(te);
    player.updateTe(te);
  });
});



{'fraction_non_alphanumeric': 0.19907407407407407, 'fraction_numerical': 0.009259259259259259, 'mean_word_length': 3.6633093525179854, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5843639', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1146, 'n_words': 173}