{"id":21717343,"url":"https://github.com/sandsmark/kart","last_synced_at":"2025-07-03T03:04:39.273Z","repository":{"id":17619840,"uuid":"20424023","full_name":"sandsmark/kart","owner":"sandsmark","description":"Compocase for the AI programming competition at The Gathering 2015","archived":false,"fork":false,"pushed_at":"2022-11-11T14:30:19.000Z","size":5377,"stargazers_count":14,"open_issues_count":5,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-30T07:31:15.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://unicorn.gathering.org/info/ai-programming","language":"C","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/sandsmark.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}},"created_at":"2014-06-03T00:05:25.000Z","updated_at":"2024-05-30T21:59:54.000Z","dependencies_parsed_at":"2023-01-11T20:26:58.125Z","dependency_job_id":null,"html_url":"https://github.com/sandsmark/kart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sandsmark/kart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandsmark%2Fkart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandsmark%2Fkart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandsmark%2Fkart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandsmark%2Fkart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandsmark","download_url":"https://codeload.github.com/sandsmark/kart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandsmark%2Fkart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263250596,"owners_count":23437288,"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":[],"created_at":"2024-11-26T01:16:16.694Z","updated_at":"2025-07-03T03:04:39.240Z","avatar_url":"https://github.com/sandsmark.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"#The Kartering (working title)\n\n![startscreen](/startscreen.png)\n\n![screenshot](/screenshot.png)\n\n**tldr**; connect to the server at localhost over port 31337. You send a single\nbitmapped number to select what to do (for example \"9\\n\" to accelerate and turn\nright), and receive a JSON status update everytime you do so. The first AI to\ncomplete a set number of laps wins!\n\nThe number is used as a bitmap, so set a bit to do that action:\n\nAction      | Player 1 | Player 2 | Bit in map |\n------------|----------|----------|------------\nAccelerate  | Up       | W        | 0\nDecelerate  | Down     | S        | 1\nTurn left   | Left     | A        | 2\nTurn right  | Right    | D        | 3\nDrift       | Comma    | C        | 4\nUse powerup | Period   | V        | 5\n\nSome pseudo C code to use it:\n\n```C\n    #define NET_INPUT_UP 1\u003c\u003c0\n    #define NET_INPUT_DOWN 1\u003c\u003c1\n    #define NET_INPUT_LEFT 1\u003c\u003c2\n    #define NET_INPUT_RIGHT 1\u003c\u003c3\n    #define NET_INPUT_SPACE 1\u003c\u003c4\n    #define NET_INPUT_RETURN 1\u003c\u003c5\n\n    char action = NET_INPUT_UP;\n    if (want_to_turn_left) {\n        action |= NET_INPUT_LEFT;\n    }\n    send_byte(action);\n```\n\nOn connect you will receive a JSON object giving you your ID and describing the\nmap:\n\n```JSON\n{\n    \"id\": 0,\n    \"map\": {\n        \"tile_width\": 128,\n        \"tile_height\": 128,\n        \"tiles\": [\n            [ \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\" ],\n            [ \".\", \"/\", \"-\", \"-\", \"-\", \"`\", \".\", \".\" ],\n            [ \".\", \"|\", \".\", \".\", \".\", \"|\", \".\", \".\" ],\n            [ \".\", \"|\", \".\", \".\", \".\", \"|\", \".\", \".\" ],\n            [ \".\", \"\\\\\", \"-\", \"-\", \"-\", \",\", \".\", \".\" ],\n            [ \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\" ]\n        ],\n        \"modifiers\": [\n            {\n                \"type\": \"mud\",\n                \"x\": 168,\n                \"y\": 218,\n                \"width\": 64,\n                \"height\": 64\n            },\n            {\n                \"type\": \"booster\",\n                \"x\": 418,\n                \"y\": 538,\n                \"width\": 32,\n                \"height\": 32\n            },\n            {\n                \"type\": \"ice\",\n                \"x\": 638,\n                \"y\": 188,\n                \"width\": 64,\n                \"height\": 64\n            }\n        ],\n        \"path\": [\n            { \"tile_x\": 3, \"tile_y\": 1 },\n            { \"tile_x\": 4, \"tile_y\": 1 },\n            { \"tile_x\": 5, \"tile_y\": 1 },\n            { \"tile_x\": 5, \"tile_y\": 2 },\n            { \"tile_x\": 5, \"tile_y\": 3 },\n            { \"tile_x\": 5, \"tile_y\": 4 },\n            { \"tile_x\": 4, \"tile_y\": 4 },\n            { \"tile_x\": 3, \"tile_y\": 4 },\n            { \"tile_x\": 2, \"tile_y\": 4 },\n            { \"tile_x\": 1, \"tile_y\": 4 },\n            { \"tile_x\": 1, \"tile_y\": 3 },\n            { \"tile_x\": 1, \"tile_y\": 2 }\n        ]\n    }\n}\n```\n\nThe types of powerups are:\n\n- \"banana\": a banana that you can drop, causes players that hit it to stop and spin\n- \"greenshell\": a shell you can shoot that subtly homes in on the nearest player\n- \"blueshell\": a shell that you can shoot that subtly homes in on the leading player\n- \"redshell\": a shell that you can shoot that just goes straight forward and bounces around\n- \"oil\": allows you to drop oil that causes players that drive over it to veer off course\n- \"mushroom\": gives you a speedup for 2500ms\n- \"bigmushroom\": gives you a speedup for 2500ms, doubles your size\n- \"lightning\": causes all causes all cars in front of you to halve in size, lose their powerups and lose 10% speed\n- \"star\": gives you a speedup for 2500ms, makes you invincible to all kinds of negative effects for 2500ms, causes cars that you collide with to stop and spin\n\nIt should be self-explanatory (otherwise please file an issue here on\ngithub or contact us otherwise so we can explain better here).\n\nThen, each time you send a command (invalid or valid), you will get back a\nstatus update JSON object like this:\n\n```JSON\n{\n    \"cars\": [\n        {\n            \"id\": 0,\n            \"direction\": {\n                \"x\": 1,\n                \"y\": 0\n            },\n            \"velocity\": {\n                \"x\": 0,\n                \"y\": 0\n            },\n            \"pos\": {\n                \"x\": 448,\n                \"y\": 153\n            },\n            \"drift\": 0,\n            \"width\": 30,\n            \"height\": 16\n        }\n    ],\n    \"shells\": [\n        {\n            \"type\": \"blue\",\n            \"x\": 342,\n            \"y\": 233,\n            \"dx\": 0.5,\n            \"dy\": 0.3\n        }\n    ],\n    \"boxes\": [\n        { \"x\": 576, \"y\": 153, \"width\": 16, \"height\": 16 },\n        { \"x\": 576, \"y\": 174, \"width\": 16, \"height\": 16 },\n        { \"x\": 576, \"y\": 195, \"width\": 16, \"height\": 16 },\n        { \"x\": 576, \"y\": 216, \"width\": 16, \"height\": 16 },\n        { \"x\": 448, \"y\": 537, \"width\": 16, \"height\": 16 },\n        { \"x\": 448, \"y\": 558, \"width\": 16, \"height\": 16 },\n        { \"x\": 448, \"y\": 579, \"width\": 16, \"height\": 16 },\n        { \"x\": 448, \"y\": 600, \"width\": 16, \"height\": 16 }\n    ],\n    \"items\": [\n        {\n            \"type\": \"oil\",\n            \"x\": 168,\n            \"y\": 218,\n            \"width\": 64,\n            \"height\": 64\n        }\n    ]\n}\n```\n\n**NOTE: the actual JSON you receive is minified, and each initial or status update is a single\nobject on a single line, terminated by a newline:**\n\n```JSON\n{\"cars\":[{\"id\":0,\"direction\":{\"x\":1,\"y\":0},\"velocity\":{\"x\":0,\"y\":0},\"pos\":{\"x\":448,\"y\":153},\"drift\":0,\"width\":30,\"height\":16}],\"shells\":[]}\n```\n\n*All messages back and forth are terminated by a newline.*\n\n\n### Build instructions\nTL;DR: Install the SDL2 development headers, and run \"make\".\n\n#### Building on Ubuntu\nOn Ubuntu (14.04), which packages you need to install might not be obvious, so try this:\n\n```bash\nsudo apt-get install build-essential libsdl2-dev\n```\n\nFrom there, it's just to run `make`, turn `kart` into an executable, and execute it!\n\n```bash\nmake\nchmod +x kart\n./kart\n```\n\n### CREDITS:\nGraphics by 'Kari Nordmann' (alias).\n\nSome compatibility code for windows is licensed under the ISC license:\nCopyright (c) 1996,1999 by Internet Software Consortium.\n\nA header for windows compatibility is licensed under the GPLv2+:\n By Gerald Combs \u003cgerald@wireshark.org\u003e\n Copyright 1998 Gerald Combs\n\n\nThe rest of the code is under an MIT license:\nCopyright (c) 2014, 2015 Lars-Ivar Hesselberg Simonsen\nCopyright (c) 2014, 2015 Martin Tobias Holmedahl Sandsmark\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandsmark%2Fkart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandsmark%2Fkart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandsmark%2Fkart/lists"}