File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed
src/07-object-oriented-design Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 11class Othello {
22 constructor ( ) {
3- this . board = new Board ( 8 ) ;
3+ this . board = new Board ( 10 ) ;
44 this . player1 = new Player ( Piece . WHITE , this . board ) ;
55 this . player2 = new Player ( Piece . BLACK , this . board ) ;
66 }
77}
88
9- class Piece {
10-
11- }
9+ const Piece = { } ;
1210
1311// Piece.WHITE = Symbol('x');
1412// Piece.BLACK = Symbol('o');
@@ -156,4 +154,6 @@ function main() {
156154 console . log ( game . board . toString ( ) ) ;
157155}
158156
159- main ( ) ;
157+ main ( ) ;
158+
159+ module . exports = Othello ;
Original file line number Diff line number Diff line change 1+ const expect = require ( 'chai' ) . expect ;
2+ const Othello = require ( './othello' ) ;
3+
4+ describe ( 'Othello' , function ( ) {
5+
6+ it ( 'should start with a default play' , function ( ) {
7+ const game = new Othello ( ) ;
8+ const p1 = game . player1 ;
9+ const p2 = game . player2 ;
10+ const board = game . board ;
11+
12+ expect ( board ) . toEqual ( '' ) ;
13+ } ) ;
14+ } ) ;
You can’t perform that action at this time.
0 commit comments