{"id":164,"date":"2026-03-25T15:14:22","date_gmt":"2026-03-25T06:14:22","guid":{"rendered":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/?p=164"},"modified":"2026-03-25T15:30:01","modified_gmt":"2026-03-25T06:30:01","slug":"tic-tac-toe-pvpoffline","status":"publish","type":"post","link":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/2026\/03\/25\/tic-tac-toe-pvpoffline\/","title":{"rendered":"Tic-Tac-Toe PVP(Offline)"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"164\" class=\"elementor elementor-164\">\n\t\t\t\t<div class=\"elementor-element elementor-element-bd7c561 e-flex e-con-boxed e-con e-parent\" data-id=\"bd7c561\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-4700da9 elementor-widget elementor-widget-text-editor\" data-id=\"4700da9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Tic-Tac-Toe program by me &amp; GPT<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-43f58d4 e-flex e-con-boxed e-con e-parent\" data-id=\"43f58d4\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-614492b elementor-widget elementor-widget-text-editor\" data-id=\"614492b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<h4>Game Rule:<\/h4>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f20f759 elementor-widget elementor-widget-text-editor\" data-id=\"f20f759\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<ol><li data-section-id=\"yqye42\" data-start=\"124\" data-end=\"163\"><strong data-start=\"127\" data-end=\"139\">Players:<\/strong> Two players, X and O.<\/li><li data-section-id=\"j3q4nk\" data-start=\"164\" data-end=\"213\"><strong data-start=\"167\" data-end=\"177\">Board:<\/strong> The game is played on a 3\u00d73 grid.<\/li><li data-section-id=\"y1e4uw\" data-start=\"214\" data-end=\"313\"><strong data-start=\"217\" data-end=\"226\">Goal:<\/strong> Get three of your marks (X or O) in a row \u2013 horizontally, vertically, or diagonally.<\/li><li data-section-id=\"1u33ixn\" data-start=\"314\" data-end=\"388\"><strong data-start=\"317\" data-end=\"327\">Turns:<\/strong> Players take turns to place their mark in an empty square.<\/li><li data-section-id=\"1poppsm\" data-start=\"389\" data-end=\"453\"><strong data-start=\"392\" data-end=\"404\">Winning:<\/strong> The first player to make a line of three wins.<\/li><li data-section-id=\"2wdddn\" data-start=\"454\" data-end=\"545\"><strong data-start=\"457\" data-end=\"466\">Draw:<\/strong> If all squares are filled and no one has three in a row, the game is a draw.<\/li><\/ol><ul><li data-section-id=\"zrt82h\" data-start=\"546\" data-end=\"622\"><strong data-start=\"549\" data-end=\"561\">Restart:<\/strong> After a win or draw, the board can be reset to play again.<\/li><\/ul>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c6339c3 elementor-widget elementor-widget-spacer\" data-id=\"c6339c3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-719a5b6 e-flex e-con-boxed e-con e-parent\" data-id=\"719a5b6\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-04868d4 elementor-widget elementor-widget-html\" data-id=\"04868d4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t\t<pre><code>\n#Source Code    \n\nimport tkinter as tk\nfrom tkinter import messagebox\n\nroot = tk.Tk()\nroot.title(\"\ud2f1\ud0dd\ud1a0 \uac8c\uc784\")\n\ncurrent_player = \"X\"\n\ndef button_click(row, col):\n    global current_player\n    if buttons[row][col][\"text\"] == \"\" :\n        buttons[row][col][\"text\"] = current_player\n        if check_winner():\n            messagebox.showinfo(\"\uac8c\uc784 \uc885\ub8cc\", f\"{current_player} \uc2b9\ub9ac!\")\n            reset_board()\n        elif is_draw():\n            messagebox.showinfo(\"\uac8c\uc784 \uc885\ub8cc\", \"\ubb34\uc2b9\ubd80!\")\n            reset_board()\n        else:\n            current_player = \"O\" if current_player == \"X\" else \"X\"\n\ndef check_winner():\n    for i in range(3):\n        if buttons[i][0][\"text\"] == buttons[i][1][\"text\"] == buttons[i][2][\"text\"] != \"\":\n            return True\n        if buttons[0][i][\"text\"] == buttons[1][i][\"text\"] == buttons[2][i][\"text\"] != \"\":\n            return True\n    if buttons[0][0][\"text\"] == buttons[1][1][\"text\"] == buttons[2][2][\"text\"] != \"\":\n        return True\n    if buttons[0][2][\"text\"] == buttons[1][1][\"text\"] == buttons[2][0][\"text\"] != \"\":\n        return True\n    return False\n\ndef is_draw():\n    for row in buttons:\n        for btn in row:\n            if btn[\"text\"] == \"\":\n                return False\n    return True\n\ndef reset_board():\n    global current_player\n    for row in buttons:\n        for btn in row:\n            btn[\"text\"] = \"\"\n    current_player = \"X\"\n\nbuttons = []\nfor i in range(3):\n    row = []\n    for j in range(3):\n        btn = tk.Button(root, text=\"\", font=(\"Arial\", 40), width=5, height=2,\n                        command=lambda r=i, c=j: button_click(r, c))\n        btn.grid(row=i, column=j)\n        row.append(btn)\n    buttons.append(row)\n\nroot.mainloop()\n<\/code><\/pre>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Tic-Tac-Toe program by me &amp; GPT Game Rule: Players: Two players, X and O. Board: The game is played on a 3\u00d73 grid. Goal: Get three of your marks (X or O) in a row \u2013 horizontally, vertically, or diagonally. Turns: Players take turns to place their mark in an empty square. Winning: The first [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":167,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-164","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/posts\/164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/comments?post=164"}],"version-history":[{"count":11,"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/posts\/164\/revisions"}],"predecessor-version":[{"id":183,"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/posts\/164\/revisions\/183"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/media\/167"}],"wp:attachment":[{"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/media?parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/categories?post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/parsleytoast.mycafe24.com\/wordpress\/wp-json\/wp\/v2\/tags?post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}