Skip to content

Instantly share code, notes, and snippets.

View whoeverest's full-sized avatar

Andrej T. whoeverest

  • Skopje, Republic of Macedonia
View GitHub Profile
openValues: function(board) {
// Returns two arrays: which values can be played on the
// left of the board, and which on the right. E.g:
//
// a) if board = [] returns [
// ['0', '1', '2', '3', '4', '5', '6'],
// ['0', '1', '2', '3', '4', '5', '6']
// ]
// b) if board = ['25'] returns [[2, 5], [2, 5]] (tile is not yet bound)
// c) if board = ['25', '56'] returns [[2], [6]]
isPlayerBlocked: function(board, boneyard, tiles) {
// A player is blocked if he/she still has tiles
// in his/her hand, but a) no valid moves can be
// played and b) the boneyard is empty.
// Try all possible combinations in the current
// situation:
var blocked = true;
_.each(tiles, function(tile) {
_.each(['left', 'right'], function(side) {
function get_html(board, start_tile) {
var board_el = $('<div class="board"/>');
var current_row = $('<div class="row"/>');
board_el.append(current_row);
var start_tile_index = current_tile_index = board.indexOf(start_tile);
var empty_space_index = 0;
while (current_tile_index >= 0) {
if ((empty_space_index - 3) % -6 == 0) {
function get_html(board, start_tile) {
var board_el = $('<div class="board"/>');
var current_row = null;
var start_tile_index = current_tile_index = board.indexOf(start_tile);
var row_index = 0;
var empty_space_index = 0;
while (current_tile_index >= 0) {
console.log('here')
var express = require('express');
var anydb_sql = require('anydb-sql');
var app = express();
app.use(express.static('public'));
var db = anydb_sql({
url: 'sqlite://memory'
})
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
#large_div {
height: 1200px;
width: 1200px;
background: url('https://192.168.1.7:5000/img/dominoes/board.png');
position: relative;
populateBoard: function() {
// If the board is empty, just place one available
// empty space.
var self = this;
// The board is always populated starting from one
// empty space, the one with the specified index. The
// tile that was played first is placed at this position,
// then the board is populated accordingly, left and right
// of the first populated space.
var express = require('express');
var app = express();
var activeState = "0";
function delayedResponse(req, res, next) {
// сите функции со req, res, next можат да бидат middleware
// во express, тоа е закон. глеј доле како ја користам
var random = 123;
setTimeout(next);
module Main where
import qualified System.Environment as Env;
add :: Int -> Int -> Int
add x y = x + y
parseInt :: String -> Int
parseInt x = read x :: Int
parseIntList :: [String] -> [Int]
toggleShuffledCardsModal: function() {
if (this.model.shuffledCards) {
this.$('.shuffled-cards-modal').remove();
var stackTypeLogo = null;
if (this.model.shuffledCards === 'rand') {
stackTypeLogo = '/img/cards/rand.png';
} else if (this.model.shuffledCards === 'hash') {
stackTypeLogo = '/img/cards/hash.png';
}