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* forwardEventsToReducer(channel) { | |
while (true) { | |
const action = yield take(channel); | |
yield put(action); | |
} | |
} | |
function* watchLogins() { | |
while (true) { |
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
let shuffle = function(array) { | |
for (var c = array.length - 1; c > 1; c--) { | |
var r = (Math.random() * c).toFixed(0); | |
var one = array[r]; | |
var two = array[c]; | |
if (one !== null) { | |
array[c] = one; |
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
import {combineReducers} from 'redux'; | |
import battleEngine, {BOT_IDENTIFIER} from './briscaEngine'; | |
import * as actions from './briscaActions'; | |
const defaultState = () => { | |
return { | |
deck: [], | |
rounds: [], | |
tableSize: 0, | |
tableOwner: null, |
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
Odd little known fact: in 1963 when there were no degrees in computer science, NCR did a study to find out what degrees would the people with computer science aptitude be likely to have. they were surprised by the result: english and music. After some thought they realized that both are people who can be creative within very defined constraints. |
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
import React from 'react'; | |
import { storiesOf } from '@storybook/react'; | |
import Provider, {initialState} from './util/provider'; | |
import LanguageProvider from '../src/App/hoc/language'; | |
import Game from '../src/App/game'; | |
import * as GameActions from '../src/store/brisca/actions'; | |
let GameWithLanguage = (props) => { | |
return (<LanguageProvider><Game {...props} /></LanguageProvider>); |
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
export const GAME_HEIGHT = 32; | |
export const GAME_WIDTH = 32; | |
export const moveSnake = ({x, y}) => ({ | |
type: "MOVE_SNAKE", | |
xVelocity: x, | |
yVelocity: y | |
}); | |
export const spawnDot = ({x = Math.random() * GAME_WIDTH, y = Math.random() * GAME_HEIGHT}) => ({ |
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
import groovyjarjarantlr.collections.List | |
class BriscaData { | |
static Map suits = [ | |
0: "Coins", | |
1: "Staffs", | |
2: "Goblets", | |
3: "Swords" | |
] | |
static Map faces = [ |
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
//Requires React, Redux installed | |
//Requires Pure Briscas, found at https://gist.github.com/atoko/39e5b0ceb2778a3b456c73e2ed082156 | |
import { createStore, combineReducers } from 'redux'; | |
import Brisca from './lib/brisca'; | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; |
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
import { | |
range, | |
shuffle | |
} from "./deckUtil"; | |
class BriscaEngine { | |
constructor(deck) { | |
this.life = this.determineSuit(deck[0]); | |
this.pointMapping = { | |
0: 11, | |
2: 10, |
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
#indent "off" | |
type Suit = | |
|Oro |Basto |Copa |Espada | |
type Face = | |
|I |II |III |IV |V |VI |VII |X |XI |XII | |
type Card = Suit * Face | |
type BriscaCard = {card:Card; isLife:bool;} | |
let BriscaValue (c : BriscaCard) = | |
match c.card with |