function status(update) {
var currentStatus = "\n" + document.getElementById("status").innerHTML;
document.getElementById("status").innerHTML = update + currentStatus;
}
function random() {
var botNames = document.getElementById("bot-name-list").value.split("\n");
var shuffledNames = shuffle(botNames);
var output = "";
shuffledNames.forEach(function(currentNumber) {
output += currentNumber + "\n";
});
document.getElementById("bot-name-list").value = output;
}
function inputNames() {
fetch("./names.txt")
.then(response => response.text())
.then(data => {
document.getElementById("bot-name-list").value = data;
});
}
function shuffle(array) {
var currentIndex = array.length,
temporaryValue,
randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
function simpleBotName(prefix, suffix) {
return prefix + suffix;
}
module.exports = {
status: status,
random: random,
inputNames: inputNames,
shuffle: shuffle,
simpleBotName: simpleBotName
};