{"id":32051,"date":"2023-05-09T11:52:35","date_gmt":"2023-05-09T11:52:35","guid":{"rendered":"https:\/\/mp.moonpreneur.com\/blog\/?p=32051"},"modified":"2026-01-12T13:25:20","modified_gmt":"2026-01-12T13:25:20","slug":"tic-tac-toe-game-in-scratch","status":"publish","type":"post","link":"https:\/\/mp.moonpreneur.com\/blog\/tic-tac-toe-game-in-scratch\/","title":{"rendered":"Making a Tic-Tac-Toe Game in Scratch"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"32051\" class=\"elementor elementor-32051\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-bef402d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"bef402d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-84af7cd\" data-id=\"84af7cd\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-995838a elementor-widget elementor-widget-text-editor\" data-id=\"995838a\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p style=\"text-align: center;\"><span style=\"color: #000080;\" data-sheets-root=\"1\"><strong>Update:<\/strong> This article was last updated on 12th January 2026 to reflect the accuracy and up-to-date information on the page.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-331ce36 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"331ce36\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ad0a57c\" data-id=\"ad0a57c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1a85044 elementor-widget elementor-widget-image\" data-id=\"1a85044\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"537\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/create-tic-tac-toe-in-scratch.webp\" class=\"attachment-large size-large wp-image-54564\" alt=\"Create Tic Tac Toe in Scratch\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-42fc505 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"42fc505\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b64134f\" data-id=\"b64134f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2437b60 elementor-widget elementor-widget-text-editor\" data-id=\"2437b60\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">&#8220;Ever <\/span><span style=\"font-weight: 400;\">thought<\/span> <span style=\"font-weight: 400;\">about <\/span><span style=\"font-weight: 400;\">how <\/span><span style=\"font-weight: 400;\">awesome it would be to create your own Tic-Tac-Toe game? Just imagine playing a game that you programmed yourself! In this tutorial, we&#8217;<\/span><span style=\"font-weight: 400;\">ll <\/span><span style=\"font-weight: 400;\">walk<\/span><span style=\"font-weight: 400;\"> you through <\/span><span style=\"font-weight: 400;\">the process of creating an interactive Tic-Tac-Toe game in Scratch\u2014step by step!&#8221;<\/span><\/span><\/p><p><span style=\"font-weight: 400; color: #000000;\">Hello and welcome to this tutorial on how to make a Tic-Tac-Toe game in Scratch. Tic-Tac-Toe is a fun game we\u2019ve all played before, and in this video, we\u2019ll be creating a version of it using Scratch. Scratch is a <\/span><a href=\"https:\/\/mp.moonpreneur.com\/blog\/visual-coding-for-kids\/\"><span style=\"font-weight: 400;\">visual programming<\/span><\/a><span style=\"font-weight: 400; color: #000000;\"> language that makes it easy for anyone to create interactive projects, games, and animations.<\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Before we begin<\/span><span style=\"font-weight: 400;\">, let us <\/span><span style=\"font-weight: 400;\">tell you that if your child wants<\/span> <span style=\"font-weight: 400;\">to<\/span> <span style=\"font-weight: 400;\">do<\/span><\/span> <a href=\"https:\/\/mp.moonpreneur.com\/blog\/block-coding-for-kids\/\"><span style=\"font-weight: 400;\">block coding<\/span><\/a><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">, Moonpreneur <\/span><span style=\"font-weight: 400;\">is<\/span> <span style=\"font-weight: 400;\">providing<\/span><span style=\"font-weight: 400;\"> pre-robotics <\/span><span style=\"font-weight: 400;\">free <\/span><span style=\"font-weight: 400;\">classes for <\/span><span style=\"font-weight: 400;\">kids aged <\/span><span style=\"font-weight: 400;\">6-8. But you <\/span><span style=\"font-weight: 400;\">must<\/span><span style=\"font-weight: 400;\"> hurry <\/span><span style=\"font-weight: 400;\">because<\/span> <span style=\"font-weight: 400;\">the <\/span><span style=\"font-weight: 400;\">offer <\/span><span style=\"font-weight: 400;\">is<\/span> <span style=\"font-weight: 400;\">temporary<\/span><span style=\"font-weight: 400;\">! So <\/span><span style=\"font-weight: 400;\">avail<\/span> <span style=\"font-weight: 400;\">of a free trial class for your kid<\/span> <span style=\"font-weight: 400;\">ASAP<\/span><span style=\"font-weight: 400;\">.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><strong>Recommended reading: <\/strong><\/span><a href=\"https:\/\/mp.moonpreneur.com\/blog\/python-games\/#google_vignette\">Top Python Games Kids Can Code<\/a><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-05fd6df elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"05fd6df\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-173cb90\" data-id=\"173cb90\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-14e9e93 elementor-widget elementor-widget-text-editor\" data-id=\"14e9e93\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><strong><span style=\"color: #800080;\">1. We must set the scene for our Tic-Tac-Toe game<\/span><\/strong><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-a47dc4a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a47dc4a\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-d1771a4\" data-id=\"d1771a4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4c6f104 elementor-widget elementor-widget-image\" data-id=\"4c6f104\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"712\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/create-grid.webp\" class=\"attachment-large size-large wp-image-54557\" alt=\"Create Grid\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-acba442\" data-id=\"acba442\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-48d3516 elementor-widget elementor-widget-text-editor\" data-id=\"48d3516\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p style=\"text-align: center;\"><span style=\"font-weight: 400; color: #000000;\">To do this, we\u2019ll need to create a 3\u00d73 grid using sprites. We\u2019ll use one sprite for each cell of the grid. First, we\u2019ll create a new sprite named \u201cgrid.\u201d Then, we\u2019ll use a different color for the lines to stand out from the background.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-4ca482d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4ca482d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3758179\" data-id=\"3758179\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e1dd398 elementor-widget elementor-widget-text-editor\" data-id=\"e1dd398\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><strong><span style=\"color: #339966;\">2. Create Sprites (X-O)<\/span><\/strong><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-a4c134e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a4c134e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-c9b6178\" data-id=\"c9b6178\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8a03db7 elementor-widget elementor-widget-video\" data-id=\"8a03db7\" data-element_type=\"widget\" data-settings=\"{&quot;youtube_url&quot;:&quot;https:\\\/\\\/youtu.be\\\/mKl6iqNMoEg&quot;,&quot;video_type&quot;:&quot;youtube&quot;,&quot;controls&quot;:&quot;yes&quot;}\" data-widget_type=\"video.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-wrapper elementor-open-inline\">\n\t\t\t<div class=\"elementor-video\"><\/div>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-7ff536c\" data-id=\"7ff536c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9796b61 elementor-widget elementor-widget-text-editor\" data-id=\"9796b61\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Now<\/span> <span style=\"font-weight: 400;\">that<\/span><span style=\"font-weight: 400;\"> we have <\/span><span style=\"font-weight: 400;\">our<\/span><span style=\"font-weight: 400;\"> grid <\/span><span style=\"font-weight: 400;\">established<\/span><span style=\"font-weight: 400;\">, we <\/span><span style=\"font-weight: 400;\">will<\/span><span style=\"font-weight: 400;\"> create sprites for <\/span><span style=\"font-weight: 400;\">O<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">X<\/span><span style=\"font-weight: 400;\">. We <\/span><span style=\"font-weight: 400;\">will<\/span> <span style=\"font-weight: 400;\">create <\/span><span style=\"font-weight: 400;\">two sprites <\/span><span style=\"font-weight: 400;\">that<\/span> <span style=\"font-weight: 400;\">are different <\/span><span style=\"font-weight: 400;\">for X and O. We also need to <\/span><span style=\"font-weight: 400;\">add<\/span><span style=\"font-weight: 400;\"> a variable <\/span><span style=\"font-weight: 400;\">for<\/span> <span style=\"font-weight: 400;\">tracking<\/span><span style=\"font-weight: 400;\"> whose turn it is.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">We <\/span><span style=\"font-weight: 400;\">must<\/span><span style=\"font-weight: 400;\"> render the grid. To <\/span><span style=\"font-weight: 400;\">achieve<\/span><span style=\"font-weight: 400;\"> this, we <\/span><span style=\"font-weight: 400;\">must<\/span> <span style=\"font-weight: 400;\">make<\/span><span style=\"font-weight: 400;\"> clones, so we will <\/span><span style=\"font-weight: 400;\">make<\/span><span style=\"font-weight: 400;\"> a variable <\/span><span style=\"font-weight: 400;\">named<\/span> <span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\">clone number<\/span><span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">assign<\/span><span style=\"font-weight: 400;\"> it <\/span><span style=\"font-weight: 400;\">a<\/span> <span style=\"font-weight: 400;\">value of <\/span><span style=\"font-weight: 400;\">zero. We will <\/span><span style=\"font-weight: 400;\">then<\/span> <span style=\"font-weight: 400;\">do <\/span><span style=\"font-weight: 400;\">this nine times and <\/span><span style=\"font-weight: 400;\">increment the clone number by one each time until we have made nine clones. We will also make another variable named<\/span> <span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\">clone ID<\/span><span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\"> that will <\/span><span style=\"font-weight: 400;\">assist<\/span><span style=\"font-weight: 400;\"> us <\/span><span style=\"font-weight: 400;\">in<\/span> <span style=\"font-weight: 400;\">assigning the X and Y positions to<\/span><span style=\"font-weight: 400;\"> each clone.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><strong>Recommended reading: <\/strong><\/span><a href=\"https:\/\/mp.moonpreneur.com\/blog\/importance-of-scratch-coding-for-kids\/\">Importance of Scratch Coding For Kids<\/a><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-f608fc5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f608fc5\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-0fa8494\" data-id=\"0fa8494\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1becd40 elementor-widget elementor-widget-image\" data-id=\"1becd40\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"741\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/create-sprites-x.webp\" class=\"attachment-large size-large wp-image-54556\" alt=\"Create Sprite X\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-9049b3d\" data-id=\"9049b3d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-72c1598 elementor-widget elementor-widget-image\" data-id=\"72c1598\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"632\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/create-sprites-o.webp\" class=\"attachment-large size-large wp-image-54559\" alt=\"Create Sprite O\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-4b095ed elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4b095ed\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-59e667b\" data-id=\"59e667b\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-110049c elementor-widget elementor-widget-text-editor\" data-id=\"110049c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><span style=\"color: #800080;\"><strong>3. Make a variable named \u201cclone ID\u201d<\/strong><\/span><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-fc598b9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"fc598b9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-1d4e1be\" data-id=\"1d4e1be\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a753e6f elementor-widget elementor-widget-image\" data-id=\"a753e6f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"710\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/clone-id.webp\" class=\"attachment-large size-large wp-image-54560\" alt=\"Clone Id\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-cffdca1\" data-id=\"cffdca1\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d8c9746 elementor-widget elementor-widget-text-editor\" data-id=\"d8c9746\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">We<\/span> <span style=\"font-weight: 400;\">now<\/span> <span style=\"font-weight: 400;\">make<\/span><span style=\"font-weight: 400;\"> a variable <\/span><span style=\"font-weight: 400;\">named<\/span> <span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\">clone ID<\/span><span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">assign<\/span><span style=\"font-weight: 400;\"> it the clone number. This <\/span><span style=\"font-weight: 400;\">way,<\/span> <span style=\"font-weight: 400;\">every<\/span> <span style=\"font-weight: 400;\">clone<\/span> <span style=\"font-weight: 400;\">will<\/span> <span style=\"font-weight: 400;\">have<\/span><span style=\"font-weight: 400;\"> a <\/span><span style=\"font-weight: 400;\">different clone ID. We will assign<\/span> <span style=\"font-weight: 400;\">the X and Y positions of<\/span> <span style=\"font-weight: 400;\">every<\/span><span style=\"font-weight: 400;\"> clone <\/span><span style=\"font-weight: 400;\">through<\/span><span style=\"font-weight: 400;\"> two lists <\/span><span style=\"font-weight: 400;\">named<\/span> <span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\">X<\/span><span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\">Y<\/span><span style=\"font-weight: 400;\">.&#8221;<\/span><\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-1058863 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"1058863\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-e8d4ea4\" data-id=\"e8d4ea4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4c050c1 elementor-widget elementor-widget-text-editor\" data-id=\"4c050c1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">We will then conceal<\/span><span style=\"font-weight: 400;\"> these lists and <\/span><span style=\"font-weight: 400;\">place them in the X and Y positions of<\/span> <span style=\"font-weight: 400;\">every<\/span><span style=\"font-weight: 400;\"> clone <\/span><span style=\"font-weight: 400;\">by<\/span> <span style=\"font-weight: 400;\">utilizing the clone ID. This will place<\/span> <span style=\"font-weight: 400;\">every<\/span><span style=\"font-weight: 400;\"> clone in its <\/span><span style=\"font-weight: 400;\">corresponding position.<\/span><\/span><\/p><p><span style=\"font-weight: 400; color: #000000;\">So, if you\u2019re facing any problems coding for the Tic-Tac-Toe game, don\u2019t hesitate to sign up for Moonpreneur\u2019s Pre-robotics trial classes today. With their help, you can become a coding master and create your games.<\/span><\/p><p><span style=\"color: #000000;\"><strong>Recommended reading: <\/strong><\/span><a href=\"https:\/\/mp.moonpreneur.com\/blog\/coding-project-ideas\/\">Top Coding Project Ideas For Beginners<\/a><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-4e4b758\" data-id=\"4e4b758\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-67f51ff elementor-widget elementor-widget-image\" data-id=\"67f51ff\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"710\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/clone-id.webp\" class=\"attachment-large size-large wp-image-54560\" alt=\"Clone Id\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-ecfc0e3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ecfc0e3\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e649071\" data-id=\"e649071\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-71df1ce elementor-widget elementor-widget-text-editor\" data-id=\"71df1ce\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><span style=\"color: #0000ff;\"><strong>4. Add some Interactivity<\/strong><\/span><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-bb066cf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"bb066cf\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b2629ff\" data-id=\"b2629ff\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6de90a2 elementor-widget elementor-widget-image\" data-id=\"6de90a2\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"581\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/interactivity.webp\" class=\"attachment-large size-large wp-image-54563\" alt=\"Interactivity\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-cc43f9f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cc43f9f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-32ee02f\" data-id=\"32ee02f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9cc6c45 elementor-widget elementor-widget-text-editor\" data-id=\"9cc6c45\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Now that we have our game board established<\/span><span style=\"font-weight: 400;\">, it<\/span><span style=\"font-weight: 400;\">&#8216;s time to add some interactivity. We&#8217;<\/span><span style=\"font-weight: 400;\">ll <\/span><span style=\"font-weight: 400;\">begin<\/span><span style=\"font-weight: 400;\"> by <\/span><span style=\"font-weight: 400;\">making<\/span><span style=\"font-weight: 400;\"> an event that <\/span><span style=\"font-weight: 400;\">happens when the player clicks on a cell in the grid. We&#8217;<\/span><span style=\"font-weight: 400;\">ll use the <\/span><span style=\"font-weight: 400;\">&#8220;<\/span><span style=\"font-weight: 400;\">when sprite clicked<\/span><span style=\"font-weight: 400;\">&#8221; block for this.<\/span><\/span><\/p><p><span style=\"font-weight: 400; color: #000000;\">When the player clicks on a cell, we\u2019ll check if it\u2019s empty. If it is, we\u2019ll place an X or O in the cell, depending on whose turn it is. We\u2019ll also need to update the turn variable.<\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">After<\/span><span style=\"font-weight: 400;\"> we have the <\/span><span style=\"font-weight: 400;\">overall<\/span><span style=\"font-weight: 400;\"> interactivity <\/span><span style=\"font-weight: 400;\">in<\/span> <span style=\"font-weight: 400;\">place<\/span><span style=\"font-weight: 400;\">, we <\/span><span style=\"font-weight: 400;\">will need to add some logic to determine<\/span><span style=\"font-weight: 400;\"> a winner. We <\/span><span style=\"font-weight: 400;\">will<\/span> <span style=\"font-weight: 400;\">look<\/span> <span style=\"font-weight: 400;\">at whether any row, column, or diagonal has three X or O in sequence. If there is a winner, we<\/span> <span style=\"font-weight: 400;\">will<\/span> <span style=\"font-weight: 400;\">show <\/span><span style=\"font-weight: 400;\">a message and <\/span><span style=\"font-weight: 400;\">stop the game.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><strong>Recommended reading: <\/strong><\/span><a href=\"https:\/\/mp.moonpreneur.com\/blog\/javascript-projects-for-beginners\/\">21 Fun JavaScript Projects for Beginners<\/a><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-5da2904 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5da2904\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a9a9238\" data-id=\"a9a9238\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-42eaedf elementor-widget elementor-widget-text-editor\" data-id=\"42eaedf\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><span style=\"color: #99cc00;\"><strong>5. Add Some Sound Effects<\/strong><\/span><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-ca72adf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ca72adf\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5a6b56d\" data-id=\"5a6b56d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3c66b85 elementor-widget elementor-widget-image\" data-id=\"3c66b85\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"1024\" height=\"482\" src=\"https:\/\/mp.moonpreneur.com\/blog\/wp-content\/uploads\/2024\/01\/sound-effect.webp\" class=\"attachment-large size-large wp-image-54562\" alt=\"Sound Effect\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-4ff3f54 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4ff3f54\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e1c5041\" data-id=\"e1c5041\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-66ac8c5 elementor-widget elementor-widget-text-editor\" data-id=\"66ac8c5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-weight: 400; color: #000000;\">Now that our game is working, it\u2019s time to add some finishing touches. We\u2019ll start by adding some sound effects to make the game more fun. We\u2019ll use <\/span><a href=\"https:\/\/mp.moonpreneur.com\/blog\/scratch-programming-for-kids\/\"><span style=\"font-weight: 400;\">Scratch\u2019s <\/span><\/a><span style=\"font-weight: 400; color: #000000;\">built-in sound library to add sound effects for when the player clicks on a cell when a move is made, and when the game is won.<\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-36d0f70 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"36d0f70\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0fe699b\" data-id=\"0fe699b\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-953567c elementor-widget elementor-widget-text-editor\" data-id=\"953567c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><span style=\"color: #808000;\"><strong>6. Add Graphics<\/strong><\/span><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-8dabe1f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8dabe1f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-661ac10\" data-id=\"661ac10\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0eeef8b elementor-widget elementor-widget-text-editor\" data-id=\"0eeef8b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-weight: 400; color: #000000;\">Next, we\u2019ll add some graphics to indicate whose turn it is. We\u2019ll use a sprite to display an X or O, depending on whose turn it is. We\u2019ll also add a message to indicate which player won the game.<\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Lastly<\/span><span style=\"font-weight: 400;\">, we<\/span><span style=\"font-weight: 400;\">&#8216;<\/span><span style=\"font-weight: 400;\">ll <\/span><span style=\"font-weight: 400;\">insert<\/span><span style=\"font-weight: 400;\"> some code to <\/span><span style=\"font-weight: 400;\">restart<\/span><span style=\"font-weight: 400;\"> the game when it<\/span><span style=\"font-weight: 400;\">&#8216;<\/span><span style=\"font-weight: 400;\">s <\/span><span style=\"font-weight: 400;\">finished<\/span><span style=\"font-weight: 400;\">. We<\/span><span style=\"font-weight: 400;\">&#8216;<\/span><span style=\"font-weight: 400;\">ll <\/span><span style=\"font-weight: 400;\">make a button that the player can press<\/span> <span style=\"font-weight: 400;\">in order <\/span><span style=\"font-weight: 400;\">to <\/span><span style=\"font-weight: 400;\">restart<\/span><span style=\"font-weight: 400;\"> the game, and <\/span><span style=\"font-weight: 400;\">then <\/span><span style=\"font-weight: 400;\">we<\/span><span style=\"font-weight: 400;\">&#8216;<\/span><span style=\"font-weight: 400;\">ll <\/span><span style=\"font-weight: 400;\">set<\/span><span style=\"font-weight: 400;\"> all <\/span><span style=\"font-weight: 400;\">of <\/span><span style=\"font-weight: 400;\">the variables and sprites <\/span><span style=\"font-weight: 400;\">back <\/span><span style=\"font-weight: 400;\">to their <\/span><span style=\"font-weight: 400;\">starting values.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">And there you have it! With a working<\/span><span style=\"font-weight: 400;\"> Tic-Tac-Toe game <\/span><span style=\"font-weight: 400;\">created in Scratch, we hope <\/span><span style=\"font-weight: 400;\">this tutorial <\/span><span style=\"font-weight: 400;\">was informative <\/span><span style=\"font-weight: 400;\">and <\/span><span style=\"font-weight: 400;\">you <\/span><span style=\"font-weight: 400;\">learned something new.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><strong>Recommended reading: <\/strong><\/span><a href=\"https:\/\/mp.moonpreneur.com\/blog\/applications-of-math-in-daily-life\/\">Useful Applications of Math in Daily Life<\/a><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-caacf18 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"caacf18\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2009a59\" data-id=\"2009a59\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7dcfd96 elementor-widget elementor-widget-text-editor\" data-id=\"7dcfd96\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><span style=\"color: #cc99ff;\"><b>Why Learn to create Tic Tac Toe in Scratch?<\/b><\/span><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-278c8f6 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"278c8f6\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-df01636\" data-id=\"df01636\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-44f4624 elementor-widget elementor-widget-text-editor\" data-id=\"44f4624\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Developing a Tic-Tac-Toe game in Scratch is not<\/span> <span style=\"font-weight: 400;\">only<\/span><span style=\"font-weight: 400;\"> a <\/span><span style=\"font-weight: 400;\">cool<\/span><span style=\"font-weight: 400;\"> project\u2014it<\/span><span style=\"font-weight: 400;\">&#8216;<\/span><span style=\"font-weight: 400;\">s <\/span><span style=\"font-weight: 400;\">an<\/span> <span style=\"font-weight: 400;\">excellent<\/span><span style=\"font-weight: 400;\"> way for <\/span><span style=\"font-weight: 400;\">children<\/span><span style=\"font-weight: 400;\"> to <\/span><span style=\"font-weight: 400;\">learn<\/span> <span style=\"font-weight: 400;\">important skills in programming and problem-solving. Here&#8217;<\/span><span style=\"font-weight: 400;\">s <\/span><span style=\"font-weight: 400;\">why<\/span> <span style=\"font-weight: 400;\">doing<\/span><span style=\"font-weight: 400;\"> this game <\/span><span style=\"font-weight: 400;\">is<\/span> <span style=\"font-weight: 400;\">good for <\/span><span style=\"font-weight: 400;\">young <\/span><span style=\"font-weight: 400;\">programmers<\/span><span style=\"font-weight: 400;\">:<\/span><\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">\u2705 <\/span><b>Critical\u00a0 Thinking<\/b><span style=\"font-weight: 400;\"> \u2013 What<\/span> <span style=\"font-weight: 400;\">it takes to learn <\/span><span style=\"font-weight: 400;\">how to <\/span><span style=\"font-weight: 400;\">create Tic Tac Toe in Scratch is<\/span> <span style=\"font-weight: 400;\">organizing<\/span><span style=\"font-weight: 400;\"> the game logic <\/span><span style=\"font-weight: 400;\">effectively<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">i.e.,<\/span><span style=\"font-weight: 400;\"> turn <\/span><span style=\"font-weight: 400;\">management <\/span><span style=\"font-weight: 400;\">and <\/span><span style=\"font-weight: 400;\">winner<\/span> <span style=\"font-weight: 400;\">check<\/span><span style=\"font-weight: 400;\">.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">\u2705 <\/span><b>Problem-Solving<\/b><span style=\"font-weight: 400;\"> \u2013 Fixing<\/span> <span style=\"font-weight: 400;\">bugs<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">e.g.,<\/span> <span style=\"font-weight: 400;\">invalid<\/span><span style=\"font-weight: 400;\"> moves or missing winning <\/span><span style=\"font-weight: 400;\">states<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">encourages<\/span> <span style=\"font-weight: 400;\">children<\/span> <span style=\"font-weight: 400;\">to <\/span><span style=\"font-weight: 400;\">think <\/span><span style=\"font-weight: 400;\">logically<\/span><span style=\"font-weight: 400;\">.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">\u2705 <\/span><b>Creativity<\/b><span style=\"font-weight: 400;\"> \u2013 With <\/span><span style=\"font-weight: 400;\">Scratch<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">children<\/span> <span style=\"font-weight: 400;\">get<\/span><span style=\"font-weight: 400;\"> to <\/span><span style=\"font-weight: 400;\">create their own board, X and O graphics<\/span><span style=\"font-weight: 400;\">, and animations, <\/span><span style=\"font-weight: 400;\">so<\/span><span style=\"font-weight: 400;\"> their game <\/span><span style=\"font-weight: 400;\">stands ou<\/span><\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">\u2705 <\/span><b>Simple AI Concepts<\/b><span style=\"font-weight: 400;\"> \u2013 If they wish<\/span><span style=\"font-weight: 400;\"> to <\/span><span style=\"font-weight: 400;\">take<\/span> <span style=\"font-weight: 400;\">it <\/span><span style=\"font-weight: 400;\">a step <\/span><span style=\"font-weight: 400;\">ahead<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">children<\/span><span style=\"font-weight: 400;\"> can <\/span><span style=\"font-weight: 400;\">include a simple AI opponent, exposing<\/span><span style=\"font-weight: 400;\"> them to <\/span><span style=\"font-weight: 400;\">simple artificial intelligence and decision-making logic.<\/span><\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Through<\/span> <span style=\"font-weight: 400;\">the<\/span> <span style=\"font-weight: 400;\">process<\/span> <span style=\"font-weight: 400;\">of<\/span> <span style=\"font-weight: 400;\">creating Tic Tac Toe in Scratch, children<\/span> <span style=\"font-weight: 400;\">develop confidence in their coding skills<\/span><span style=\"font-weight: 400;\"> while <\/span><span style=\"font-weight: 400;\">enjoying<\/span> <span style=\"font-weight: 400;\">themselves. So why not challenge your child to create their own version today?<\/span><\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-eb2658b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"eb2658b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9c196d4\" data-id=\"9c196d4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3d15bfd elementor-widget elementor-widget-text-editor\" data-id=\"3d15bfd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h3 style=\"text-align: center;\"><strong><span style=\"color: #0000ff;\">Conclusion<\/span><\/strong><\/h3>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"has_eae_slider elementor-section elementor-top-section elementor-element elementor-element-0a6247f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"0a6247f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"has_eae_slider elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-63b00be\" data-id=\"63b00be\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5a650b7 elementor-widget elementor-widget-text-editor\" data-id=\"5a650b7\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><span style=\"font-weight: 400; color: #000000;\">Scratch is a great tool for anyone who wants to learn how to program, and making games is a fun way to practice your skills. So if you\u2019re excited to take on the world of Scratch coding, join Moonpreneur\u2019s Free Pre-Robotics Trial class to build more exciting games!<\/span><\/p><p><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Moonpreneur aims<\/span><span style=\"font-weight: 400;\"> to <\/span><span style=\"font-weight: 400;\">revolutionize<\/span> <span style=\"font-weight: 400;\">conventional education and future-proof the future<\/span><span style=\"font-weight: 400;\"> generation <\/span><span style=\"font-weight: 400;\">through<\/span> <span style=\"font-weight: 400;\">comprehensive learning solutions. Its <\/span><\/span><a href=\"https:\/\/moonpreneur.com\/home\/book-a-free-trial\/\"><span style=\"font-weight: 400;\">Innovator Program<\/span><\/a><span style=\"color: #000000;\"><span style=\"font-weight: 400;\"> is creating<\/span><span style=\"font-weight: 400;\"> tomorrow<\/span><span style=\"font-weight: 400;\">&#8216;<\/span><span style=\"font-weight: 400;\">s workforce by <\/span><span style=\"font-weight: 400;\">empowering<\/span><span style=\"font-weight: 400;\"> students <\/span><span style=\"font-weight: 400;\">with training in AI\/ML<\/span><\/span><a href=\"https:\/\/moonpreneur.com\/innovator-program\/robotics\/\"><span style=\"font-weight: 400;\"><span style=\"color: #000000;\">,<\/span> Robotics,<\/span><\/a><span style=\"color: #000000;\"><span style=\"font-weight: 400;\"> Coding, IoT, and Apps, and<\/span> <span style=\"font-weight: 400;\">facilitating <\/span><span style=\"font-weight: 400;\">entrepreneurship through experiential learning.<\/span><\/span><\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Update: This article was last updated on 12th January 2026 to reflect the accuracy and up-to-date information on the page. &#8220;Ever thought about how awesome it would be to create your own Tic-Tac-Toe game? Just imagine playing a game that you programmed yourself! In this tutorial, we&#8217;ll walk you through the process of creating an [&hellip;]<\/p>\n","protected":false},"author":116,"featured_media":32083,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false},"categories":[865,478,974],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/posts\/32051"}],"collection":[{"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/users\/116"}],"replies":[{"embeddable":true,"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/comments?post=32051"}],"version-history":[{"count":13,"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/posts\/32051\/revisions"}],"predecessor-version":[{"id":94763,"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/posts\/32051\/revisions\/94763"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/media\/32083"}],"wp:attachment":[{"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/media?parent=32051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/categories?post=32051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mp.moonpreneur.com\/blog\/wp-json\/wp\/v2\/tags?post=32051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}