Javascript

Overview

The version of Javascript supported is Javascript NodeJS 12.14.0

Each turn your source code will be compiled within a new sandbox, by default no information is shared or persisted between turns, if you wish to persist data then you should use the User Data field within the API.


Input - Standard Input (STDIN)

Within NodeJS you can use readline to capture the STDIN input

var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

Ouput - Standard Outout (STDOUT)

Within NodeJS you can simply use console.log() to return your CSV based instructions to BotWars.

rl.on('line', function(line){
    console.log(line);
})

Example Bot

var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', function(line){
    console.log(line);
})
❤️ Feedback