Skip to content

Commit b0e0a13

Browse files
author
Paul van Brenk
committed
More simplification.
1 parent 1b6fab6 commit b0e0a13

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

mankala/Base.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace Base {
88
data: T;
99
insertAfter(entry: IList<T>): IList<T>;
1010
insertBefore(entry: IList<T>): IList<T>;
11-
item();
1211
empty(): boolean;
1312
}
1413

@@ -18,10 +17,6 @@ namespace Base {
1817

1918
constructor(public isHead: boolean, public data: T) { }
2019

21-
item() {
22-
return this.data;
23-
}
24-
2520
empty(): boolean {
2621
return this.next == this;
2722
}

mankala/Game.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,11 @@ namespace Mankala {
1414
const humanScoreId = "humanScore";
1515
const computerScoreId = "computerScore"
1616

17-
export interface IPositionList extends Base.IList<Position> {
18-
data: Position;
19-
push(pos: Position);
20-
pop(): Position;
21-
}
22-
23-
function pushPosition(pos: Position, l: IPositionList) {
17+
function pushPosition(pos: Position, l: Base.IList<Position>) {
2418
l.insertAfter(Base.listMakeEntry(pos));
2519
}
2620

27-
function popPosition(l: IPositionList) {
21+
function popPosition(l: Base.IList<Position>) {
2822
var entry = Base.listRemove(l.next);
2923
if (entry != null) {
3024
return entry.data;
@@ -43,7 +37,7 @@ namespace Mankala {
4337
export class Game {
4438
private position = new DisplayPosition([3, 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0);
4539
private prevConfig: SeedCoords[][];
46-
private q: IPositionList = null;
40+
private q: Base.IList<Position> = null;
4741
private scores: number[] = null;
4842
private positionCount = 0;
4943
private moveCount = 0;
@@ -165,7 +159,7 @@ namespace Mankala {
165159

166160
private findMove() {
167161
var timeStart = new Date().getTime();
168-
this.q = <IPositionList>Base.listMakeHead<Position>();
162+
this.q = Base.listMakeHead<Position>();
169163
this.scores = [NoScore, NoScore, NoScore, NoScore, NoScore, NoScore];
170164
pushPosition(this.position, this.q);
171165
var deltaTime = 0;

0 commit comments

Comments
 (0)