<commit_before>#AI-Nibbles Server

A game server for AI-nibbles game (clone of the classic Q-basic game).

**Note: The server is an early alpha version.**

## Requirements

* [Node.JS] (http://nodejs.org)

## Installation

    git clone https://github.com/MattiLehtinen/ai-nibbles-server.git
    cd ai-nibbles-server
    npm install

## Running
    npm start

## API

### Join or Create if no game exists

    {"msg":"join", "data": {
        "player": {
            "name": "<NAME>"
        }
    }}

    
If new game is created, server sends:

    {"msg":"created", "data":{"gameId": "442152"}


### Join existing game

    {"msg":"join", "data":{"gameId": "442152", "player": {"name": "<NAME>"}}}

Server sends for each player's join:

    {"msg":"joined", "data":{"gameId": "442152", "player" {...}}}

### Game starts

Server sends:

    {"msg":"start", "data":{"players": [{name: "<NAME>"}, {"name": "<NAME>"}]}}

### Game update

    {"msg":"positions", "data":{...}}<commit_msg>Improve readme<commit_after>#AI Nibbles Server

A game server for AI Nibbles game (clone of the classic Q-basic game).

**Note: The server is an early alpha version.**

## Requirements

* [Node.JS] (http://nodejs.org)

## Installation

    git clone https://github.com/MattiLehtinen/ai-nibbles-server.git
    cd ai-nibbles-server
    npm install

Don't mind if you get MSBUILD errors. There is an optional native compilation step with socket.io which require
Visual Studio to be installed on windows but it will work fine without.

## Running

* Run Server: `npm start`
* Start [user interface](#user-interface) to watch the game
* Join 2 bots to start the game

## Configuration

Currently you need to change configuration parameters on `app.js` file.

## User Interface

You can use [AI Nibbles Monitor] (https://github.com/MattiLehtinen/ai-nibbles-monitor) to watch games. 

## Sample AI Implementation

See [sample node.js AI implementation] (https://github.com/MattiLehtinen/ai-nibbles-sample).

## API

### Join or Create if no game exists

    {"msg":"join", "data": {
        "player": {
            "name": "<NAME>"
        }
    }}

    
If new game is created, server sends:

    {"msg":"created", "data":{"gameId": "442152"}


### Join existing game

    {"msg":"join", "data":{"gameId": "442152", "player": {"name": "<NAME>"}}}

Server sends for each player's join:

    {"msg":"joined", "data":{"gameId": "442152", "player" {...}}}

### Game starts

Server sends:

    {"msg":"start", "data":{"players": [{name: "<NAME>"}, {"name": "<NAME>"}]}}

### Game update

    {"msg":"positions", "data":{...}}
{'fraction_non_alphanumeric': 0.18276260100038477, 'fraction_numerical': 0.014236244709503656, 'mean_word_length': 3.537521815008726, 'pattern_counts': {'":': 42, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 4, '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': '2785021', 'n_tokens_mistral': 882, 'n_tokens_neox': 813, 'n_words': 265}