{"id":19287541,"url":"https://github.com/tachoknight/crazy8s","last_synced_at":"2026-04-15T18:01:57.988Z","repository":{"id":146215520,"uuid":"67724132","full_name":"tachoknight/crazy8s","owner":"tachoknight","description":"The game 'Crazy 8s' written in Swift","archived":false,"fork":false,"pushed_at":"2019-07-12T19:24:48.000Z","size":10274,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-01T22:39:02.867Z","etag":null,"topics":["card","card-game","cards","crazy-eights","game","linux","player","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tachoknight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2016-09-08T17:14:09.000Z","updated_at":"2019-07-12T19:24:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"a4083984-e5e4-47de-88ea-f1e37f64ebdc","html_url":"https://github.com/tachoknight/crazy8s","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tachoknight/crazy8s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachoknight%2Fcrazy8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachoknight%2Fcrazy8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachoknight%2Fcrazy8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachoknight%2Fcrazy8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tachoknight","download_url":"https://codeload.github.com/tachoknight/crazy8s/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachoknight%2Fcrazy8s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31853279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","card-game","cards","crazy-eights","game","linux","player","swift"],"created_at":"2024-11-09T22:06:12.268Z","updated_at":"2026-04-15T18:01:57.983Z","avatar_url":"https://github.com/tachoknight.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crazy Eights\n\n## tl;dr\nThe game [Crazy Eights](https://en.wikipedia.org/wiki/Crazy_Eights) implemented in Swift (Swift 4 compatible).\n\n## Rationale\nMy daughter taught me the game [Crazy Eights](https://en.wikipedia.org/wiki/Crazy_Eights) while we were on vacation and it seemed like it was easy enough to implement as a way to learn how to do cross Linux/macOS Swift development, where the macOS verison was still using 2.2 syntax, while Linux uses a Swift 3 preview build. I also wanted to write a self-playing game. \n\n### macOS\nThe project was originally written on macOS so it includes the usual XCode-specific files. \n### Linux\nFor building in Linux all you have to do is run\n`swiftc -DDEBUG card.swift extensions.swift main.swift player.swift`\nto produce an executable. `-DDEBUG` is necessary to see any output in this version.\n\n## Playing\nIn `main.swift` there are three constants, `PLAYERS`, `DECKS`, and `CARDCOUNT` that determine the number of players in the game, the number of decks of cards, and how many cards the players hold (my daughter insisted this be changeable as her rules seemd to be at odds with the `official' Wikipedia version). For a 'quick' game, setting these values to reasonable numbers (four players, eight cards per hand, one deck) results in a quick-ish game that you can use to test any tweaks to the game algorithm. For yucks I upped the number of players to 15,000 with 5,000 decks of cards; \"shuffling\" the cards takes the longest amount of time, it turns out, than playing the game itself.\n\n## Files\n### `main.swift`\nThe main file of the game, where the number of players, cards-in-hand, and decks are determined. The game itself is played in this file.\n### `card.swift`\nThis file contains enums for setting up the deck (and learning Swift enums was one of the reasons why I started the project, as they seem to be similar and even more powerful to the Java Enum), as well as the `Card` structure, and a function to create an array of cards (`createDeck()`).\n### `extensions.swift`\nThis is one of the things I love most about Swift (and Objective-C) is the ability to add methods to a class without dealing with inheritance. These extensions are used for in-place 'shiffling', as well as extending `Dictionary` to allow for using the `Card` struct as a key.\n### `player.swift`\nThis is where the 'brains' of the game are. The player decides which card to play (and where the rules of the game are essentially implemented), in the function `canPlayOn(deckCard:orSuit:)`. It doesn't have much 'strategy' insofar as it plays the game according to the rules. Feel free to try your own strategies here.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftachoknight%2Fcrazy8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftachoknight%2Fcrazy8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftachoknight%2Fcrazy8s/lists"}