1
0
Fork 0

Fixed game saving when an AI is in play

This commit is contained in:
Michaël Lemaire 2015-04-26 21:46:52 +02:00
parent ee8bf3b4a3
commit 9045f7e5c3
2 changed files with 7 additions and 3 deletions

View file

@ -1,13 +1,17 @@
/// <reference path="Serializable.ts"/>
module SpaceTac.Game {
"use strict";
// Random generator, used in all throws
export class RandomGenerator {
export class RandomGenerator extends Serializable {
// Array of next values, empty for a correct generator
private fake_values: number[];
// Basic constructor (can specify fake values as arguments)
constructor(...values: number[]) {
super();
this.fake_values = [];
values.forEach((value: number) => {

View file

@ -6,14 +6,14 @@ module SpaceTac.Game.Specs {
function applyGameSteps(session: GameSession): void {
var battle = session.getBattle();
battle.advanceToNextShip();
// TODO Make some moves (IA?)
// TODO Make some moves (AI?)
battle.endBattle(battle.fleets[0]);
}
describe("GameSession", () => {
it("serializes to a string", () => {
var session = new GameSession();
session.startQuickBattle(false);
session.startQuickBattle(true);
// Dump and reload
var dumped = session.saveToString();