This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | |
} |
OlderNewer