Kategorie: Android

Schnopsn: Card Shuffling Algorithm

Randomness is something that is often counter-intuitive and individual perception of random series, for example a deck of cards, might sometimes give the impression that there is some kind of „intelligence“ or plan behind it.

After various user requests, on how the card shuffling for Schnopsn works, and if it is really random we decided to publish our simple, but effective shuffling algorithm here … and yes, the card distribution is totally random, we do not interfere with it in any case.

Our algorithm is based on the following pseudocode, suggested in this article: http://www.cigital.com/papers/download/developer_gambling.php

FOR CT = 1, WHILE CT <= 52, DO

And here is our Java Implemenation of the code as it is 1:1 used on the server side of Schnopsn Online as well as in the Singleplayer mode of the Android App. We are aware that we use the current millisecond as random seed, but that should be perfectly fine for our purpose.

	ArrayList cards = getFullDeck();

        //	GET RANDOM SEED
	Random randomGenerator = new Random(); // here, the seed is the current millisecond

        //	FOR CT = 1, WHILE CT <= size, DO
	int size = cards.size();
	for (int ct = 0; ct < size; ct++) {

		int x = (randomGenerator.nextInt(size - ct)) + ct; // number between ct and size-1

		if (x != ct) {
			Card tempCard = cards.get(ct);
			cards.set(ct, cards.get(x));
			cards.set(x, tempCard);

So, if you have any educated comments or suggestions on how this simple algorithm can be improved or if you see shortcomings, just let us know by posting here or contacting us via support@schnopsn.com

Schnopsn Online

We built to a free-to-play beta online version of Schnopsn end of February and since then we have been working on improving it, partially based on our ideas, partially based on user feedback (thanks for the great feedback by the way). Users can play against others online right away, without any annoying registration or logins as we consider the device as your identification. Schnopsers are ranked based on an ELO system like in chess – the best players by ability should be ranked first.

Currrently, despite the beta and the fact that we did virtually no marketing so far, around 10.000 „Bummerls“ each day are played on our server, and we have over 50.000 active device installs.
At the moment, online play is only available for Android, but once we are „feature complete“ on client and server side we will also introduce the online version on iOS and later also on the web and probably other platforms like Windows Phone or Blackberry.

Why did we do it on Android first? It is not because of a certain preference for one system or another, we love and hate all of them, it is simply because we can roll out new version in order to improve and try out new things whenever we want, within two hours instead of a two-weeks-approval phase, so iterative develpment, rollout and immediate user feedback is feasible. We did about a new version each week since beginning of March.

At that point we have to say sorry for the frequent updates, still it is a small app with around 10-15 MB in size, but as with iOS Gaming Apps with sizes up to around 1GB are a common sight, many Android users tend to be concerned about 10 MB Traffic for an Update 🙂 Its not a stereotype, Android and iOS users are in fact pretty different audiences in many ways, with quite a different mentality, both having their good and bad sides from our point of view.


But beta phase is going to end soon and the app will be more and more stable so update frequency will certainly go down.
When stabilizing, we a learned lot about the tweaks of Android native app development (did we like it? Well, let’s put it that way: we’ll seriously give Cocos2dx a try as key technology for future gaming projects). Android is not only fragmented by different device types, but also by different API versions, an example where it gets tricky is display and memory management for bitmaps / images but finally we got it working.

We also experimented with certain Ad networks – mobile advertising is truly a science on its own. However traditional banner apps or even interstitials only pay off with huge numbers of users, the income from ads is no serious alternative to paid content, but still it is better than nothing, pays at least part of out server running costs. We may try other forms of advertising like video or push messsages in the future, but when beta phase is over we have come up with an appropriate way of monetizing the online playing user base in order to keep the Schnopsn Online going.