Skip to content
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

Open
samurailink3 opened this issue Dec 12, 2012 · 6 comments
Open

Shuffle Cards for Card Czar #15

samurailink3 opened this issue Dec 12, 2012 · 6 comments

Comments

@samurailink3
Copy link
Owner

Currently, cards come in in the order they are submitted. Cards should be shuffled before being presented to the Card Czar.

@icbat
Copy link

icbat commented Jan 25, 2013

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 $('.xxxx') syntax works, whether that can be mutated or not. If it can't, I suppose the other possibility is to modify revealCards to save a cache it as a var first, then shuffle, then show.

Thoughts? I'm sorry to write with such ignorance, but hopefully I'm on a right-ish track.

@magic-madrigal
Copy link

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

@joshuha
Copy link
Contributor

joshuha commented Jan 28, 2013

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.

@samurailink3
Copy link
Owner Author

I think randomizing the order for everyone (even un-synced) is a decent idea.

@tresi
Copy link
Contributor

tresi commented Apr 23, 2013

Unrandomized cards when the czar is reading/selecting is the number 1 complaint from the group I play with.

@samurailink3
Copy link
Owner Author

@joshuha is planning on this being included in the v2 rewrite.

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

No branches or pull requests

5 participants