Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

implemented up to 4 player mode #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pinion31
Copy link

Functionality to play with up to 4 players added. Dropdown element added for player to select number of players.

@ketanhwr
Copy link
Owner

Thanks for your pull request but #14 was made much more before, so I've proceeded with that 🙁

@ketanhwr ketanhwr closed this Dec 14, 2017
@ketanhwr ketanhwr reopened this Dec 16, 2017
@ketanhwr
Copy link
Owner

This seems like it would work, I'll do a review.

Copy link
Owner

@ketanhwr ketanhwr left a 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};
Copy link
Owner

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
}

Copy link
Owner

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'])
Copy link
Owner

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() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function resetTurnCount()
{

{
turnCount = 0;
}
}
Copy link
Owner

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()
Copy link
Owner

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() {
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants