-
Notifications
You must be signed in to change notification settings - Fork 40
implemented up to 4 player mode #15
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request but #14 was made much more before, so I've proceeded with that 🙁 |
This seems like it would work, I'll do a review. |
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.
Take a look into my comments. Rest seem fine 🙂
turnCountBackup=0; | ||
gameStarted = false; | ||
round = 0; | ||
playersEliminated = {red:false,green:false,blue:false,yellow:false}; |
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.
A little spacing would make code more easier to read as well as extend later on.
} else { | ||
$('#changePlayerError').stop().fadeIn(400).delay(2000).fadeOut(400); //fade out after 2 seconds | ||
} | ||
|
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.
What's this empty line for?
|
||
if(turnCount === 0) | ||
{ | ||
if (!playersEliminated['red']) |
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.
Instead of passing 'red'
, 'blue'
, etc. you can create another array with all the color names, and just iterate from 0->3. This would easily allow adding more colors later on 🙂
} | ||
} | ||
} | ||
|
||
function resetTurnCount() { |
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.
function resetTurnCount()
{
{ | ||
turnCount = 0; | ||
} | ||
} |
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.
An empty line after this.
@@ -257,7 +393,7 @@ function updateMatrix() | |||
|
|||
function checkGameOver() |
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.
Why did I repeat this function definition twice? Strange. I think you can remove it.
@@ -290,28 +424,77 @@ function notStable() | |||
return ans; | |||
} | |||
|
|||
// Next 2 Functions are used to undo elimination of players | |||
function backUpCopyofPlayersEliminated() { |
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.
{
should start from next line in order to maintain consistency.
Functionality to play with up to 4 players added. Dropdown element added for player to select number of players.