-
Notifications
You must be signed in to change notification settings - Fork 35
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
Shuffle Cards for Card Czar #15
Comments
Here's how I've been looking at this. I'm pretty new to JS, so I'm posting to ask for some help groking the code. function doReaderTurn() {
...
...
...
function checkSubmission()
{
numLoops++;
//all submission in or 3 minutes passed (in case of a drop)
Ext.getCmp('gameStatePanel').setTitle("Round Timer:" + (120-numLoops) + " seconds");
if (numSubmissions == numPlayers-1 || numLoops > 120) {
clearInterval(sLoop);
Ext.getCmp('gameStatePanel').setTitle("Game State");
// New bit
shuffleAnswers();
revealCards();
}
}
}
} with that new function looking something like: function shuffleAnswers()
{
$(.'answerContainer').sort(function ()
{
return 0.5 - Math.random()
}; //Unsure how to make this nested anonymous fn match your bracket style
} It obviously doesn't have to be its own function (but maybe should be for readability). I don't really grasp how the Thoughts? I'm sorry to write with such ignorance, but hopefully I'm on a right-ish track. |
I'm going to be playing a game in my test environment tonight. I will add your code, and let you know what I find. -Ed |
So the $() selector syntax is just jQuery selectors. A personal preference but you can use the normal JS selectors fine still. The issue I have been coming up with in a randomizer function is it is easy enough to do for the Czar but synching it with the client seems to be a pain. It only matter most for the Czar but might still be odd that the Czar is clicking say his left one but it's really the middle one on everyone else's screen. We could just have everyone randomize order on every screen and it wouldn't be huge deal as long as the right card got revealed. |
I think randomizing the order for everyone (even un-synced) is a decent idea. |
Unrandomized cards when the czar is reading/selecting is the number 1 complaint from the group I play with. |
@joshuha is planning on this being included in the v2 rewrite. |
Currently, cards come in in the order they are submitted. Cards should be shuffled before being presented to the Card Czar.
The text was updated successfully, but these errors were encountered: