{"id":18248900,"url":"https://github.com/sametcn99/tic-tac-toe","last_synced_at":"2025-08-02T19:09:38.741Z","repository":{"id":204057755,"uuid":"711015383","full_name":"sametcn99/tic-tac-toe","owner":"sametcn99","description":"Tic-Tac-Toe with AI is a web-based game built using React. The game provides a simple interface for playing Tic-Tac-Toe against an AI opponent. The game logic is implemented in JavaScript, and it uses the minimax algorithm to create a challenging AI opponent.","archived":false,"fork":false,"pushed_at":"2024-12-13T22:13:17.000Z","size":294,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-27T10:54:17.749Z","etag":null,"topics":["minimax-algorithm","nextjs","tic-tac-toe","tic-tac-toe-javascript"],"latest_commit_sha":null,"homepage":"https://tic-tac-toe-sametcn99.vercel.app","language":"TypeScript","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/sametcn99.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":"2023-10-28T01:09:52.000Z","updated_at":"2025-06-19T08:08:31.000Z","dependencies_parsed_at":"2024-02-29T22:23:31.408Z","dependency_job_id":"8c74e61f-9ad4-44dd-9eb5-122b96fa65b5","html_url":"https://github.com/sametcn99/tic-tac-toe","commit_stats":null,"previous_names":["sametcn99/tic-tac-toe"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sametcn99/tic-tac-toe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Ftic-tac-toe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Ftic-tac-toe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Ftic-tac-toe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Ftic-tac-toe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sametcn99","download_url":"https://codeload.github.com/sametcn99/tic-tac-toe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcn99%2Ftic-tac-toe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268439663,"owners_count":24250671,"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-08-02T02:00:12.353Z","response_time":74,"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":["minimax-algorithm","nextjs","tic-tac-toe","tic-tac-toe-javascript"],"created_at":"2024-11-05T09:38:40.141Z","updated_at":"2025-08-02T19:09:38.702Z","avatar_url":"https://github.com/sametcn99.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tic-Tac-Toe with AI README\n\nThis README provides an overview of the Tic-Tac-Toe game with AI implemented using React. This project includes a web-based Tic-Tac-Toe game that allows you to play against an AI opponent.\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Features](#features)\n- [How to Run](#how-to-run)\n- [Game Logic](#game-logic)\n- [AI Implementation](#ai-implementation)\n\n## Introduction\n\nTic-Tac-Toe with AI is a web-based game built using React. The game provides a simple interface for playing Tic-Tac-Toe against an AI opponent. The game logic is implemented in JavaScript, and it uses the minimax algorithm to create a challenging AI opponent.\n\n## Features\n\n- Play Tic-Tac-Toe against an AI opponent.\n- The AI uses the minimax algorithm to make smart moves.\n- Keep track of the score between the player and the AI.\n- Restart the game or reset the score with ease.\n\n## How to Run\n\nTo run the Tic-Tac-Toe game on your local machine, follow these steps:\n\n1. Make sure you have Node.js installed. If not, you can download it [here](https://nodejs.org/).\n\n2. Clone the repository to your local machine:\n\n```bash\ngit clone https://github.com/sametcn99/tic-tac-toe\n```\n\n3. Navigate to the project directory:\n\n```bash\ncd tic-tac-toe\n```\n\n4. Install the project dependencies:\n\n```bash\nnpm i\n```\n\n5. Start the development server:\n\n```bash\nnpm run dev\n```\n\n## Game Logic\n\nThe game logic is implemented in the `src/page.tsx` file. Here's a brief overview of how the game works:\n\n- The game board is represented as an array with 9 elements, initially filled with `null`. Each element corresponds to a square on the board.\n\n- The game keeps track of whose turn it is using the `xIsNext` state variable.\n\n- User interactions are handled by the `handleClick` function, which updates the game board and checks for a winner or a draw.\n\n- The game status, displayed at the top of the interface, informs the player whose turn it is or if the game has been won or is a draw.\n\n- The `handleRestart` function allows the player to reset the game, and the `handleResetScore` function resets the score.\n\n## AI Implementation\n\nThe AI in this game is implemented using the minimax algorithm, a well-known algorithm for finding the best move in two-player games. The key functions for the AI are located in the `src/utils/utils.js` file:\n\n- `minimax(board, player, isMaximizing)`: This function recursively evaluates the game board to find the best move for the AI (maximizing player) or the opponent (minimizing player).\n\n- `getBestMove(board, player, isMaximizing)`: This function identifies the best move for the AI to make using the minimax algorithm.\n\n- `calculateWinner(squares)`: This function checks if there is a winner on the game board.\n\nThe AI takes into account all possible moves and their outcomes to make strategic decisions in the game.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsametcn99%2Ftic-tac-toe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsametcn99%2Ftic-tac-toe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsametcn99%2Ftic-tac-toe/lists"}