No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
js
.editorconfig
.eslintrc
.gitignore
LICENSE
README.md
build.js
index.html
package.json
test.html

README.md

Brain Buster

This is a clone of the Mastermind board game using HTML, CSS and JavaScript.

Development

Begin by installing dependencies with this command in the checkout's root:

npm install

The recommended editor is Sublime Text 3, with these plugins:

  • Babel
  • EditorConfig
  • SublimeLinter
  • SublimeLinter-contrib-eslint

To ensure that ES6 JavaScript is correctly syntax highlighted, open a JavaScript file and enable Babel:

View > Syntax > Open all with current extension as... > Babel > JavaScript (Babel)

Running

The best way to run the game is by serving the files from a web server; the easiest way to do that is by installing and running the http-server package:

npm install http-server -g http-server

The server will run on http://localhost:8080/.

Building

To build all the JavaScript into a single bundle, run this command:

node build.js

This will create dist/brainbuster.js, which can be added to a web page with a script tag:

<script type="text/javascript" src="js/brainbuster.js"></script>

Place the script tag before the closing </body> tag, to ensure the DOM is ready when the script executes.

The DOM must contain a div for the game to append itself to:

<div class="brainbuster"></div>

Tests

The unit tests currently only run in a browser. Once you have a web server running go to:

http://localhost:8080/test.html

Mocha is the test framework. Chai is the assertion library, with BDD style expect being favoured.

New test suites have to be manually added to the test runner by editing test.html; new test files are not automatically detected and run.

CSS

The CSS adheres to these rules:

  • Class names are prefixed with bb-.
  • Class names are written in lowercase, with hyphens to separate words.