{"id":19293408,"url":"https://github.com/marianpekar/cardamom.js","last_synced_at":"2025-08-03T06:37:48.052Z","repository":{"id":148501591,"uuid":"165450868","full_name":"marianpekar/Cardamom.js","owner":"marianpekar","description":"A JavaScript library for making card games easy","archived":false,"fork":false,"pushed_at":"2019-01-23T17:21:30.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-05T20:41:21.272Z","etag":null,"topics":["card-games","gamedev","javascript","library"],"latest_commit_sha":null,"homepage":"https://marianpekar.github.io/Cardamom.js/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marianpekar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-13T00:38:29.000Z","updated_at":"2024-03-23T15:08:31.000Z","dependencies_parsed_at":"2023-04-25T18:48:10.560Z","dependency_job_id":null,"html_url":"https://github.com/marianpekar/Cardamom.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianpekar%2FCardamom.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianpekar%2FCardamom.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianpekar%2FCardamom.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marianpekar%2FCardamom.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marianpekar","download_url":"https://codeload.github.com/marianpekar/Cardamom.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240396765,"owners_count":19794727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["card-games","gamedev","javascript","library"],"created_at":"2024-11-09T22:34:56.190Z","updated_at":"2025-02-24T00:20:42.033Z","avatar_url":"https://github.com/marianpekar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About Cardamom.js\n\nAll card games are same! Well, they're not actually. However, they have so much in common you'd be using the same chunks of code (or rather say logic) while building a Black Jack, Texas Hold'em or Rummy for instance. That's why I've created Cardamom - a JavaScript library to prevent reinventing the wheel and provide all the logic you need for building a card game whether it's based on rules of an existing card game or on your own.\n\n# Getting Started\n\nLet's say you have a game with two players which get 4 cards from a shuffled standard 52 cards deck and then one card goes on table. With Cardamom.js included you can do it like this.\n\n```javascript\nlet deck = Cardamom.CreateDeck(4,13);\nCardamom.Shuffle(deck);\n\nlet player_one = Cardamom.CreateHand();\nlet player_two = Cardamom.CreateHand();\nCardamom.MoveCards(deck,player_one,sides.top,sides.top,4);\nCardamom.MoveCards(deck,player_two,sides.top,sides.top,4);\n\nlet table = Cardamom.CreateTable();\nCardamom.MoveCard(deck,table,sides.top,sides.top);\n```\n\nAnd what if you'd like to know if player one has bigger sum of values of cards that have the same color as the card on table? Two lines of code for that.\n\n```javascript\nlet card_on_table_color =  Cardamom.GetColorOfCard(table,0);\nCardamom.GetSumOfColors(player_one,card_on_table_color) \u003e Cardamom.GetSumOfColors(player_two,card_on_table_color);\n```\n\nNow you'd want to take all cards and put them back to the bottom of your deck. With Cardamom.js you can handle it with a single line.\n\n```javascript\nCardamom.Merge(deck,[table,player_one,player_two]);\n```\n\nAnd that's it! For just an eleven lines of code quite a nice card game, right? In case you're interested to see a litle bit more complex example, check out **Vingt-et-un (Twenty-One) in the examples folder**. \n\nRead out what all you can do with Cardamom.js [in Docs here](https://marianpekar.github.io/Cardamom.js/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarianpekar%2Fcardamom.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarianpekar%2Fcardamom.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarianpekar%2Fcardamom.js/lists"}