{"id":33339256,"url":"https://github.com/mrs-wilderness/plpgsql-tic-tac-toe","last_synced_at":"2026-06-10T04:31:05.590Z","repository":{"id":324760409,"uuid":"1097862451","full_name":"mrs-wilderness/plpgsql-tic-tac-toe","owner":"mrs-wilderness","description":"A small SQL implementation of Tic-Tac-Toe using stored procedures and temporary tables.","archived":false,"fork":false,"pushed_at":"2025-11-17T17:25:10.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-17T19:19:57.253Z","etag":null,"topics":["plpgsql","postgresql","sql","tic-tac-toe"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","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/mrs-wilderness.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-17T00:09:15.000Z","updated_at":"2025-11-17T17:25:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mrs-wilderness/plpgsql-tic-tac-toe","commit_stats":null,"previous_names":["mrs-wilderness/plpgsql-tic-tac-toe"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mrs-wilderness/plpgsql-tic-tac-toe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrs-wilderness%2Fplpgsql-tic-tac-toe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrs-wilderness%2Fplpgsql-tic-tac-toe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrs-wilderness%2Fplpgsql-tic-tac-toe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrs-wilderness%2Fplpgsql-tic-tac-toe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrs-wilderness","download_url":"https://codeload.github.com/mrs-wilderness/plpgsql-tic-tac-toe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrs-wilderness%2Fplpgsql-tic-tac-toe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34137570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"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":["plpgsql","postgresql","sql","tic-tac-toe"],"created_at":"2025-11-21T10:03:42.120Z","updated_at":"2026-06-10T04:31:05.586Z","avatar_url":"https://github.com/mrs-wilderness.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tic-Tac-Toe in PL/pgSQL\n\nThis project is a simple implementation of the Tic-Tac-Toe game written entirely in PL/pgSQL. It uses two functions to create and update the game state directly inside the database. Each function call returns the current 3×3 board or the final game result, making it possible to play the whole game through SQL queries.\n\n## Task-imposed implementation constraints\n\nThis project was originally written as a student assignment, and several task constraints dictated how the implementation had to be structured:\n\n- each board cell had to be stored as a separate table row  \n- arrays, strings, and other compact board formats were not allowed  \n- the program had to expose exactly two public functions (NewGame and NextMove)  \n- the symbol for each move had to be determined automatically because the game alternates turns  \n\nBecause of these requirements, the game state is stored in temporary tables inside the database session rather than using a more typical or compact representation.\n\n## How it works\n\nThe game stores its state in two temporary tables: one for the board cells and one for the game status. NewGame resets everything and returns an empty 3×3 board. NextMove checks whether the move is valid, places the symbol, switches the player, and checks for a win or a tie. The helper function getBoard simply returns the current board in a readable 3×3 format (e.g. to peek at the board after the game is over).\n\n## How to use\n\nTo start a new game, call NewGame. Each move is made by calling NextMove with the desired coordinates. If you want to view the board independently of making a move, you can also call getBoard.\n\nExamples:\n\n```sql\nSELECT * FROM NewGame();\nSELECT * FROM NextMove(1, 2);\nSELECT * FROM getBoard();\n```\n\n## Limitations\n\nOnly one game can run per database session.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrs-wilderness%2Fplpgsql-tic-tac-toe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrs-wilderness%2Fplpgsql-tic-tac-toe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrs-wilderness%2Fplpgsql-tic-tac-toe/lists"}