Hi, ich muss für die Schule ein Tic Tac Toe Spiel programmieren und mir fehlen noch 2 Sachen bis ich das Spiel fertig habe. 1. wenn 3 X's oder O's in einer Reihe/Zeile/Diagonale sind, sollte irgendeine Gewinnmeldung kommen oder nichts mehr drückbar sein. Und 2. Ein Button wo mit ich das Spiel neustarten kann. Ich weiss jetzt nicht genau wie ich das machen soll, da ich nicht sehr gut in Programmieren bin. Könnte mir jemand vielleicht dabei helfen?

Danke im Vorraus!

btw so sieht mein Code bis jetzt aus:

<!DOCTYPE html>

<html>

<head>

   <style>

        .button {

         background-color: #EE82EE; /* Violet */

         color: black;

         padding: 80px 80px;

         text-align: center;

         border-style: solid;

         }

        div {padding-right: 350px;

         float: right;

         display: grid;

         grid-template-columns: auto auto auto;}

        .py-script {display: none;}

        h1 {text-align: center;

        padding: 5px;}

        #myHeader {background-color: Violet;

        color: black;

        padding: 40px;

        text-align: center;

        font-size: 30px;

        font-weight: bold;}

    </style>    

<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css"/>

<script defer src="https://pyscript.net/alpha/pyscript.js"></script>

</head>

   <body style="background-color:rgb(176, 180, 230);">

   <h1 id="myHeader">Welcome to tic tac toe</h1>

   <h1 style="font-size:20px;">Enjoy your time here and Good luck!</h1>

   <h1 style="font-size:20px;">May the best player win</h1>

  <py-script>

x=1

a=[0,1,2,3,4,5,6,7,8,9]

def click(n):

  global x

  if x==1 and n==a[n]:

   document.getElementById("button" + str(n)).innerHTML = "X"

   x=2

   a[n]="x"

  elif n==a[n]:

    document.getElementById("button" + str(n)).innerHTML = "O"

    x=1

    a[n]="o"

</py-script>

<div>

<button class="button" id="button1" pys-onclick="lambda e: click(1)"> + </button>

<button class="button" id="button2" pys-onclick="lambda e: click(2)"> - </button>

<button class="button" id="button3" pys-onclick="lambda e: click(3)"> + </button>

<button class="button" id="button4" pys-onclick="lambda e: click(4)"> - </button>

<button class="button" id="button5" pys-onclick="lambda e: click(5)"> + </button>

<button class="button" id="button6" pys-onclick="lambda e: click(6)"> - </button>

<button class="button" id="button7" pys-onclick="lambda e: click(7)"> + </button>

<button class="button" id="button8" pys-onclick="lambda e: click(8)"> - </button>

<button class="button" id="button9" pys-onclick="lambda e: click(9)"> + </button>

</div>

</body>

</html>