Skip to content

Instantly share code, notes, and snippets.

View gist:e9fee573f06fe09bcaf0afdf7e35bcf5
/**
* Pawn object
* @param Player player
* @param string role pawn || queen
* @constructor
*/
function Pawn(player, role) {
this.player = player;
this.maxStep = 1;
this.role = role || 'pawn';
@eldad87
eldad87 / JavascriptBinarySearchArrayPrototype
Last active Oct 7, 2017
Add Binary Search capabilities to native Array
View JavascriptBinarySearchArrayPrototype
/**
* Binary search
*
* @example:
* var arr = [0, 2];
* arr.binarySearch(0) -> true
* arr.binarySearch(2) -> true
* arr.binarySearch(-1)-> false
* arr.binarySearch(1) -> false
* arr.binarySearch(3) -> false