File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ import { Transport } from './transport';
1616 * Otherwise, returns a playerID of a bot that may play now.
1717 */
1818export function GetBotPlayer ( state , bots ) {
19+ if ( state . ctx . gameover !== undefined ) {
20+ return null ;
21+ }
22+
1923 if ( state . ctx . stage ) {
2024 for ( const key of Object . keys ( bots ) ) {
2125 if ( key in state . ctx . stage ) {
Original file line number Diff line number Diff line change @@ -106,6 +106,19 @@ describe('GetBotPlayer', () => {
106106 ) ;
107107 expect ( result ) . toEqual ( null ) ;
108108 } ) ;
109+
110+ test ( 'gameover' , ( ) => {
111+ const result = GetBotPlayer (
112+ {
113+ ctx : {
114+ currentPlayer : '0' ,
115+ gameover : true ,
116+ } ,
117+ } ,
118+ { '0' : { } }
119+ ) ;
120+ expect ( result ) . toEqual ( null ) ;
121+ } ) ;
109122} ) ;
110123
111124describe ( 'LocalMaster' , ( ) => {
You can’t perform that action at this time.
0 commit comments