Comparing version 0.1.0-pre to 0.1.1-pre
import Obs = require('observers'); | ||
export const enum Player { | ||
Zero, | ||
One | ||
} | ||
import Enum = require('./src/enums'); | ||
export const enum Command { | ||
None, | ||
Print, | ||
Delete, | ||
Enter, | ||
Save, | ||
IfThen | ||
} | ||
export import Command = Enum.Command; | ||
export const enum Direction { | ||
Vertical, | ||
Horizontal | ||
export import Direction = Enum.Direction; | ||
export import Player = Enum.Player; | ||
export interface PlayerCard extends Card { | ||
owner: Player; | ||
effect: () => void; | ||
} | ||
export interface Card { | ||
owner: Player; | ||
command: Command; | ||
direction: Direction; | ||
effect: () => void; | ||
} | ||
@@ -34,16 +26,17 @@ | ||
owner: Player; | ||
cards: Array<Card>; | ||
cards: Obs.ObservableArray<PlayerCard>; | ||
hand: Obs.ObservableArray<PlayerCard>; | ||
} | ||
export interface Grid { | ||
Ten: Array<Card>; | ||
Twenty: Array<Card>; | ||
Thirty: Array<Card>; | ||
Forty: Array<Card>; | ||
Fifty: Array<Card>; | ||
Ten: Obs.ObservableArray<PlayerCard>; | ||
Twenty: Obs.ObservableArray<PlayerCard>; | ||
Thirty: Obs.ObservableArray<PlayerCard>; | ||
Forty: Obs.ObservableArray<PlayerCard>; | ||
Fifty: Obs.ObservableArray<PlayerCard>; | ||
} | ||
export interface Row { | ||
cards: Array<Card>; | ||
cards: Array<PlayerCard>; | ||
owner: Player; | ||
} |
{ | ||
"name": "binary-cg", | ||
"version": "0.1.0-pre", | ||
"version": "0.1.1-pre", | ||
"description": "Binary Card Game engine", | ||
@@ -31,4 +31,4 @@ "main": "src/index", | ||
"dependencies": { | ||
"observers": "^0.5.1" | ||
"observers": "^0.5.2" | ||
} | ||
} |
var CG = require('../index.d.ts'); | ||
var Enum = require('./enums'); | ||
var obs = require('observers'); | ||
var makeDeck = require('./makeDeck'); | ||
exports.Command = Enum.Command; | ||
exports.Player = Enum.Player; | ||
exports.Direction = Enum.Direction; | ||
var Game = (function () { | ||
function Game() { | ||
this.turn = obs.observe(0 /* Zero */); | ||
var _this = this; | ||
this.turn = obs.observe(CG.Player.Zero); | ||
this.shuffle = function (deck) { return deck.cards.sort(function () { return Math.random() > Math.random() ? 1 : -1; }); }; | ||
this.discarded = obs.observeArray([]); | ||
this.start = function () { | ||
var commands = Object.keys(exports.Command) | ||
.filter(function (key) { return isNaN(exports.Command[key]); }) | ||
.map(function (value) { return Number(value); }); | ||
var decks = makeDeck(commands); | ||
_this.oneDeck = decks.one; | ||
_this.zeroDeck = decks.zero; | ||
_this.grid = { | ||
Ten: obs.observeArray([]), | ||
Twenty: obs.observeArray([]), | ||
Thirty: obs.observeArray([]), | ||
Forty: obs.observeArray([]), | ||
Fifty: obs.observeArray([]), | ||
}; | ||
var noCards = function (cards) { return cards.length === 0 ? _this.endGame() : void 0; }; | ||
var rowFiftyFull = function (cards) { return cards.length === 3 ? _this.endGame() : void 0; }; | ||
_this.oneDeck.cards.subscribe(noCards); | ||
_this.zeroDeck.cards.subscribe(noCards); | ||
_this.grid.Fifty.subscribe(rowFiftyFull); | ||
}; | ||
this.takeCard = function (deck) { | ||
}; | ||
this.endGame = function () { }; | ||
} | ||
return Game; | ||
})(); | ||
exports.Game = Game; | ||
//# sourceMappingURL=index.js.map |
import * as CG from '../index.d.ts'; | ||
import Enum = require('./enums'); | ||
import obs = require('observers'); | ||
import makeDeck = require('./makeDeck'); | ||
class Game { | ||
constructor() {} | ||
export import Command = Enum.Command; | ||
export import Player = Enum.Player; | ||
export import Direction = Enum.Direction; | ||
export class Game { | ||
constructor() { | ||
} | ||
turn = obs.observe(CG.Player.Zero); | ||
shuffle = (deck: CG.Deck) => deck.cards.sort(() => Math.random() > Math.random() ? 1 : -1); | ||
discarded = obs.observeArray<CG.PlayerCard>([]); | ||
oneDeck: CG.Deck; | ||
zeroDeck: CG.Deck; | ||
grid: CG.Grid; | ||
start = () => { | ||
var commands = Object.keys(Command) | ||
.filter(key => isNaN(Command[key])) | ||
.map(value => Number(value)); | ||
var decks = makeDeck(commands); | ||
this.oneDeck = decks.one; | ||
this.zeroDeck = decks.zero; | ||
this.grid = { | ||
Ten: obs.observeArray([]), | ||
Twenty: obs.observeArray([]), | ||
Thirty: obs.observeArray([]), | ||
Forty: obs.observeArray([]), | ||
Fifty: obs.observeArray([]), | ||
}; | ||
var noCards = (cards: CG.PlayerCard[]) => cards.length === 0 ? this.endGame() : void 0; | ||
var rowFiftyFull = (cards: CG.PlayerCard[]) => cards.length === 3 ? this.endGame() : void 0; | ||
this.oneDeck.cards.subscribe(noCards) | ||
this.zeroDeck.cards.subscribe(noCards); | ||
this.grid.Fifty.subscribe(rowFiftyFull); | ||
} | ||
takeCard = (deck: CG.Deck) => { | ||
} | ||
turn = obs.observe(CG.Player.Zero); | ||
shuffle = (deck: CG.Deck) => deck.cards.sort(() => Math.random() > Math.random() ? 1 : -1); | ||
discarded = obs.observeArray<CG.Card>([]); | ||
endGame = () => {}; | ||
} |
@@ -0,0 +0,0 @@ // Type definitions for chai 3.2.0 |
@@ -0,0 +0,0 @@ // Type definitions for mocha 2.2.5 |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
124634
19
2725
Updatedobservers@^0.5.2