-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ver tabuleiro #1
base: master
Are you sure you want to change the base?
Conversation
src/node/board.js
Outdated
function Board(size) { | ||
const board = { | ||
size, | ||
matrix: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could call here directly, there would be no problem at all!
const board = {
size,
matrix: BoardConstruct(newSize),
...
}
src/node/board.js
Outdated
board.matrix[point.y][point.x].setSymbol(symbol); | ||
}, | ||
print: () => { | ||
BoardPrinter(board.matrix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you created an abstraction in your game called Board
, this BoardPrinter
would make more sense to receive an actual board than the matrix, right?
When you create a function, pay attention to what you are making it depend of. It makes more sense to a BoardPrinter to depend on a Board than on a "matrix
src/node/boardConstructor.js
Outdated
for (let i = 0; i < boardLength; i += 1) { | ||
const rowOfTiles = []; | ||
for (let j = 0; j < boardWidth; j += 1) { | ||
rowOfTiles.push(tileGenerator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always be consistent! If you name add "generator" to functions that create a new instance of something, you should add "generator" to all functions that do that. For example, why Board
and not BoardGenerator
? Why this function is not Capitalized? (TitleGenerator()
)?
src/node/boardConstructor.js
Outdated
const boardWidth = newSize; | ||
const matrixOfTiles = []; | ||
|
||
for (let i = 0; i < boardLength; i += 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm If you used "boardWidth
" for one axis, why not "boardHeight
" for the other? It's an exaggeration but "boardLength" could actually mean the length of an array with boards! not its actual dimension
@@ -0,0 +1,2 @@ | |||
master[m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can delete this file!
No description provided.