Gewinnmeldung & Neustart in TicTacToe, wie mache ich das?

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>

HTML, Python
discord.py fehlermeldung?

Hallo ihr lieben,

ich bin ein programmier anfänger und ich habe nun vor einen discord bot zu coden ich habe einen anfangs schrit in phyton vn einem video übernommen aber es kommt der fehler

Traceback (most recent call last):

 File "C:\Users\jweiling\PycharmProjects\NightmaresSystem\main.py", line 53, in <module>

   bot.run("")

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 828, in run

   asyncio.run(runner())

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 44, in run

   return loop.run_until_complete(main)

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete

   return future.result()

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 817, in runner

   await self.start(token, reconnect=reconnect)

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 746, in start

   await self.connect(reconnect=reconnect)

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 672, in connect

   raise PrivilegedIntentsRequired(exc.shard_id) from None

discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000002D2B160>

Traceback (most recent call last):

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 116, in __del__

   self.close()

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 108, in close

   self._loop.call_soon(self._call_connection_lost, None)

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 719, in call_soon

   self._check_closed()

 File "C:\Users\jweiling\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 508, in _check_closed

   raise RuntimeError('Event loop is closed')

RuntimeError: Event loop is closed

hat wer eine Ahnung

LG Hyper

Python, Pycharm, Discord, Discord Bot

Meistgelesene Beiträge zum Thema Python