{"id":18979637,"url":"https://github.com/reputeless/siv3d-go","last_synced_at":"2026-02-18T15:01:18.453Z","repository":{"id":67723594,"uuid":"54310595","full_name":"Reputeless/Siv3D-Go","owner":"Reputeless","description":"第 3 回 Siv3D Game Jam (テーマ「プログラムだけで碁盤と碁石を描く」) 参加作品","archived":false,"fork":false,"pushed_at":"2016-03-20T10:03:55.000Z","size":287,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-21T08:47:16.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/Reputeless.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}},"created_at":"2016-03-20T09:52:31.000Z","updated_at":"2016-03-20T09:52:31.000Z","dependencies_parsed_at":"2024-04-19T08:47:07.408Z","dependency_job_id":null,"html_url":"https://github.com/Reputeless/Siv3D-Go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Reputeless/Siv3D-Go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reputeless%2FSiv3D-Go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reputeless%2FSiv3D-Go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reputeless%2FSiv3D-Go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reputeless%2FSiv3D-Go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Reputeless","download_url":"https://codeload.github.com/Reputeless/Siv3D-Go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reputeless%2FSiv3D-Go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006638,"owners_count":26084149,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-08T15:44:16.836Z","updated_at":"2025-10-11T08:42:27.337Z","avatar_url":"https://github.com/Reputeless.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Siv3D-Go\n第 3 回 Siv3D Game Jam (テーマ「プログラムだけで碁盤と碁石を描く」) 参加作品\n\n#### 作者  \nReputeless (https://twitter.com/Reputeless)\n\n![スクリーンショット](Go.png \"スクリーンショット\")\n\n#### 説明  \n碁盤の模様: Perlin Noise  \n碁石: レイトレーシングで球を描いた Image  \n左クリックで黒、右クリックで白  \n\n#### コード  \n```cpp\n# include \u003cSiv3D.hpp\u003e\n\nconst Size offset(30, 30);\nconst Size padding(18, 18);\nconst int32 blockSize = 28;\nconst Rect goban(offset, 18 * Size(blockSize, blockSize) + padding * 2);\n\nPoint GetPos(const Point\u0026 xy)\n{\n\treturn offset + padding + xy * blockSize;\n}\n\nImage CreateGoban()\n{\n\tPerlinNoise noise;\n\treturn Image(800, 800, [\u0026](const Point\u0026 p)\n\t{\n\t\tconst double x = Fraction(noise.octaveNoise0_1(p * Vec2(0.03, 0.0002), 2) * 25) * 0.15 + 0.85;\n\t\treturn ColorF(x, 0.7 * Pow(x, 1.3), 0.35 *x);\n\t}).gaussianBlurred(1, 1).scaled(goban.size);\n}\n\nImage CreateStone(bool black)\n{\n\tconst Vec4 sphere(0, 0, 1.5, 1.0);\n\tconst Vec3 lightDir = Vec3(-1, 1, -1).normalized();\n\n\treturn Image(200, 200, [=](const Point\u0026 p)\n\t{\n\t\tconst Vec3 dir = Vec3(p.x / 100.0 - 1.0, p.y / -100.0 +1.0, 1.0).normalized();\t\n\t\tconst double B = -sphere.xyz().dot(dir);\n\t\tconst double D = B * B - (sphere.xyz().dot(sphere.xyz()) - (sphere.w * sphere.w));\n\n\t\tif (D \u003e 0.0)\n\t\t{\n\t\t\tconst double t = -B - Sqrt(D);\n\n\t\t\tif (t \u003e 0.0)\n\t\t\t{\n\t\t\t\tconst Vec3 pos = dir * t;\n\t\t\t\tconst Vec3 normal = (pos - sphere.xyz()).normalized();\t\t\n\t\t\t\tconst Vec3 half = (lightDir - pos.normalized()).normalized();\n\t\t\t\tconst double diffuse = Max(normal.dot(lightDir), 0.0) * (black ? 0.02 : 1.5);\n\t\t\t\tconst double specular = Pow(Max(normal.dot(half), 0.0), 32);\n\t\t\t\treturn ColorF(Pow(diffuse + specular, 1.0 / 2.2));\n\t\t\t}\n\t\t}\n\n\t\treturn ColorF(black ? 0.0 : 0.5, 0.0);\n\t}).scaled(0.158);\n}\n\nvoid Main()\n{\n\tWindow::Resize(800, 600);\n\tGraphics::SetBackground(Color(170, 170, 110));\n\tconst Texture textureGoban(CreateGoban());\n\tconst Texture textureBlack(CreateStone(true));\n\tconst Texture textureWhite(CreateStone(false));\n\tGrid\u003cint32\u003e stones(19, 19, 0);\n\n\twhile (System::Update())\n\t{\n\t\tgoban.drawShadow({ 6, 6 }, 20, 5);\n\t\tgoban(textureGoban).draw();\n\n\t\tfor (auto i : step(19))\n\t\t{\n\t\t\tLine(GetPos({ 0, i }), GetPos({ 18, i })).moveBy(0.5, 0.5).draw(Color(20));\n\t\t\tLine(GetPos({ i, 0 }), GetPos({ i, 18 })).moveBy(0.5, 0.5).draw(Color(20));\n\t\t}\n\n\t\tfor (auto x : { 3, 9, 15 })\n\t\t{\n\t\t\tfor (auto y : { 3, 9, 15 })\n\t\t\t{\n\t\t\t\tCircle(GetPos({ x, y }), 2.1).moveBy(0.5, 0.5).draw(Color(0));\n\t\t\t}\n\t\t}\n\n\t\tfor (auto p : step({ 19,19 }))\n\t\t{\n\t\t\tif (const int32 stone = stones[p])\n\t\t\t{\n\t\t\t\tCircle(GetPos(p), 13).drawShadow({ 2.5, 2.5 }, 3, 1);\n\t\t\t\t(stone == 1 ? textureBlack : textureWhite).drawAt(GetPos(p));\n\t\t\t}\n\t\t}\n\n\t\tconst Point pp((Mouse::Pos() - offset - (Size(blockSize, blockSize) - padding) / 2) / blockSize);\n\n\t\tif (stones.inBounds(pp.y, pp.x))\n\t\t{\n\t\t\tif (!stones[pp])\n\t\t\t{\n\t\t\t\tCircle(GetPos(pp), 13).moveBy(0.5, 0.5).drawFrame(5, 0, Color(255, 0, 40, 127));\n\t\t\t}\n\n\t\t\tif (Input::MouseL.clicked)\n\t\t\t{\n\t\t\t\tstones[pp] = (stones[pp] != 1);\n\t\t\t}\n\t\t\telse if (Input::MouseR.clicked)\n\t\t\t{\n\t\t\t\tstones[pp] = (stones[pp] != 2) * 2;\n\t\t\t}\n\t\t}\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freputeless%2Fsiv3d-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freputeless%2Fsiv3d-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freputeless%2Fsiv3d-go/lists"}