Skip to content

dstucki/javascript-jass-bot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

javascript-jass-bot

Javascript Client for https://github.com/webplatformz/challenge

Requirements

  • Node v4.1.x or higher

Installation

  • initialize new npm project with npm init
  • npm install javascript-jass-bot -S
  • create index.js file with content:
'use strict';

let Bot = require('javascript-jass-bot');

class BotStrategy {
    requestTrumpf(cards) {
        // e.g. choose TRUMPF SPADES
        let response = {};
        response.mode = 'TRUMPF';
        response.trumpfColor = 'SPADES';
        return response;
    }
    
    playCard(myCards, playedCards, gameState) {
        // e.g. play random
        return myCards[Math.floor(Math.random()*myCards.length)];
    }
    
    
    gameFinished(data) {
        console.log(data);
    }

    notifyError(error) {
        console.log(error);
    }
}

new Bot('BotName').withStrategy(new BotStrategy()).connect('localhost:3000');
  • run it with node index.js (or use nodemon)

Contribute

  1. Clone repo
  2. npm start

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%