Computing and Predicting Winning Hands in the Trick-Taking Game of Klaverjas

  • Jan N. van Rijn
  • Frank W. Takes
  • Jonathan K. Vis
Conference paper
Part of the Communications in Computer and Information Science book series (CCIS, volume 1021)


This paper deals with the trick-taking game of Klaverjas, in which two teams of two players aim to gather as many high valued cards for their team as possible. We propose an efficient encoding to enumerate possible configurations of the game, such that subsequently \(\alpha \beta \)-search can be employed to effectively determine whether a given hand of cards is winning. To avoid having to apply the exact approach to all possible game configurations, we introduce a partitioning of hands into \(981,\!541\) equivalence classes. In addition, we devise a machine learning approach that, based on a combination of simple features is able to predict with high accuracy whether a hand is winning. This approach essentially mimics humans, who typically decide whether or not to play a dealt hand based on various simple counts of high ranking cards in their hand. By comparing the results of the exact algorithm and the machine learning approach we are able to characterize precisely which instances are difficult to solve for an algorithm, but easy to decide for a human. Results on almost one million game instances show that the exact approach typically solves a game within minutes, whereas a relatively small number of instances require up to several days, traversing a space of several billion game states. Interestingly, it is precisely those instances that are always correctly classified by the machine learning approach. This suggests that a hybrid approach combining both machine learning and exact search may be the solution to a perfect real-time artificial Klaverjas agent.


Trick-taking card games Alpha-beta search Computational complexity Machine learning AI 



The second author was supported by funding from the European Research Council (ERC) under the EU Horizon 2020 research and innovation programme (grant agreement 638946). We thank F.F. Bodrij and A.M. Stawska for assistance with qualitative real-world validation of a relevant feature subset.


  1. 1.
    Beckenbach, E.F.: Applied Combinatorial Mathematics. Krieger Publishing Co., Inc., Melbourne (1981)zbMATHGoogle Scholar
  2. 2.
    Bonnet, É., Jamain, F., Saffidine, A.: On the complexity of trick-taking card games. In: IJCAI, pp. 482–488 (2013)Google Scholar
  3. 3.
    Breiman, L.: Random forests. Mach. Learn. 45(1), 5–32 (2001)CrossRefGoogle Scholar
  4. 4.
    Breiman, L., Friedman, J., Stone, C.J., Olshen, R.: Classification and Regression Trees. Chapman and Hall/CRC, Wadsworth (1984)zbMATHGoogle Scholar
  5. 5.
    Buro, M., Long, J.R., Furtak, T., Sturtevant, N.R.: Improving state evaluation, inference, and search in trick-based card games. In: IJCAI, pp. 1407–1413 (2009)Google Scholar
  6. 6.
    Frank, I., Basin, D.: Search in games with incomplete information: a case study using bridge card play. Artif. Intell. 100(1–2), 87–123 (1998)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Ginsberg, M.L.: GIB: imperfect information in a computationally challenging game. J. Artif. Intell. Res. 14, 303–358 (2001)CrossRefGoogle Scholar
  8. 8.
    Hearn, R.A.: Games, puzzles, and computation. Ph.D. thesis, Massachusetts Institute of Technology (2006)Google Scholar
  9. 9.
    van den Herik, H.J., Uiterwijk, J.W., van Rijswijck, J.: Games solved: now and in the future. Artif. Intell. 134(1–2), 277–311 (2002)CrossRefGoogle Scholar
  10. 10.
    Hoogeboom, H.J., Kosters, W.A., van Rijn, J.N., Vis, J.K.: Acyclic constraint logic and games. ICGA J. 37(1), 3–16 (2014)CrossRefGoogle Scholar
  11. 11.
    Knuth, D.E.: The Art of Computer Programming, Volume 4, Fascicle 3: Generating All Combinations and Partitions. Addison-Wesley Professional, Boston (2005)zbMATHGoogle Scholar
  12. 12.
    Knuth, D.E., Moore, R.W.: An analysis of alpha-beta pruning. Artif. Intell. 6(4), 293–326 (1975)MathSciNetCrossRefGoogle Scholar
  13. 13.
    Kupferschmid, S., Helmert, M.: A skat player based on Monte-Carlo simulation. In: van den Herik, H.J., Ciancarini, P., Donkers, H.H.L.M.J. (eds.) CG 2006. LNCS, vol. 4630, pp. 135–147. Springer, Heidelberg (2007). Scholar
  14. 14.
    Long, J.R., Buro, M.: Real-Time opponent modeling in trick-taking card games. In: IJCAI, vol. 22, pp. 617–622 (2011)Google Scholar
  15. 15.
    Long, J.R., Sturtevant, N.R., Buro, M., Furtak, T.: Understanding the success of perfect information Monte Carlo sampling in game tree search. In: AAAI (2010)Google Scholar
  16. 16.
    Parlett, D.: The Penguin Book of Card Games. Penguin, London (2008)Google Scholar
  17. 17.
    Pearl, J.: The solution for the branching factor of the alpha-beta pruning algorithm and its optimality. Commun. ACM 25(8), 559–564 (1982)MathSciNetCrossRefGoogle Scholar
  18. 18.
    Pedregosa, F., et al.: Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011)MathSciNetzbMATHGoogle Scholar
  19. 19.
    van Rijn, J.N., Takes, F.W., Vis, J.K.: The complexity of Rummikub problems. In: Proceedings of the 27th Benelux Conference on Artificial Intelligence (2015)Google Scholar
  20. 20.
    van Rijn, J.N., Vis, J.K.: Endgame analysis of Dou Shou Qi. ICGA J. 37(2), 120–124 (2014)CrossRefGoogle Scholar
  21. 21.
    Silver, D., et al.: Mastering the game of Go with deep neural networks and tree search. Nature 529(7587), 484–489 (2016)CrossRefGoogle Scholar
  22. 22.
    Silver, D., et al.: Mastering the game of Go without human knowledge. Nature 550(7676), 354–359 (2017) CrossRefGoogle Scholar
  23. 23.
    Wästlund, J.: A solution of two-person single-suit whist. Electron. J. Comb. 12(1) (2005). Paper #R43Google Scholar
  24. 24.
    Wästlund, J.: Two-person symmetric whist. Electron. J. Comb. 12(1) (2005). Paper #R44Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Jan N. van Rijn
    • 2
    • 4
  • Frank W. Takes
    • 3
    • 4
  • Jonathan K. Vis
    • 1
    • 4
  1. 1.Leiden University Medical CenterLeidenThe Netherlands
  2. 2.Columbia UniversityNew YorkUSA
  3. 3.University of AmsterdamAmsterdamThe Netherlands
  4. 4.Leiden UniversityLeidenThe Netherlands

Personalised recommendations