-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change some interfaces to abstract classes
- Loading branch information
1 parent
984052c
commit 221ed42
Showing
13 changed files
with
67 additions
and
83 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export function isAutoPlayer(player) { | ||
return ("moveWithOpponent" in player && | ||
typeof player.moveWithOpponent === "function"); | ||
export class Player { | ||
} | ||
export class AutoPlayer extends Player { | ||
} |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
import { Cell } from "./playground"; | ||
import { Cell } from "./playground.js"; | ||
|
||
export interface Player { | ||
markPlaying: "O" | "X" | null; | ||
winCount: number; | ||
select(...arg: any): [number, number]; | ||
export abstract class Player { | ||
public abstract markPlaying: "O" | "X" | null; | ||
public abstract winCount: number; | ||
public abstract select(...arg: any): [number, number]; | ||
} | ||
|
||
export interface AutoPlayer extends Player { | ||
moveWithOpponent(position: [number, number], latestBoard: Cell[][]): void; | ||
} | ||
|
||
export function isAutoPlayer(player: Player): player is AutoPlayer { | ||
return ( | ||
"moveWithOpponent" in player && | ||
typeof player.moveWithOpponent === "function" | ||
); | ||
export abstract class AutoPlayer extends Player { | ||
public abstract moveWithOpponent( | ||
position: [number, number], | ||
latestBoard: Cell[][] | ||
): void; | ||
} |
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
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
Oops, something went wrong.