File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,9 @@ var model = {
7373
7474 if ( direction === 1 ) { // horizontal
7575 row = Math . floor ( Math . random ( ) * this . boardSize ) ;
76- col = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength ) ) ;
76+ col = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength + 1 ) ) ;
7777 } else { // vertical
78- row = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength ) ) ;
78+ row = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength + 1 ) ) ;
7979 col = Math . floor ( Math . random ( ) * this . boardSize ) ;
8080 }
8181
Original file line number Diff line number Diff line change @@ -99,9 +99,9 @@ var model = {
9999
100100 if ( direction === 1 ) { // horizontal
101101 row = Math . floor ( Math . random ( ) * this . boardSize ) ;
102- col = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength ) ) ;
102+ col = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength + 1 ) ) ;
103103 } else { // vertical
104- row = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength ) ) ;
104+ row = Math . floor ( Math . random ( ) * ( this . boardSize - this . shipLength + 1 ) ) ;
105105 col = Math . floor ( Math . random ( ) * this . boardSize ) ;
106106 }
107107
You can’t perform that action at this time.
0 commit comments