Orodha ya maudhui:
- Hatua ya 1: Ingiza
- Hatua ya 2: Mizizi
- Hatua ya 3: Kazi Baada ya Kuweka Katika Mhariri Inaonyesha Maonyo Bonyeza Warrnigs na Uipe Assambel Yote
- Hatua ya 4: Nambari ya Mwisho Itatoa Mwonekano wa Mwisho?
Video: Mchezo wa Toe wa Tic Tic Tac: Hatua 4
2024 Mwandishi: John Day | [email protected]. Mwisho uliobadilishwa: 2024-01-30 12:48
chatu tic tac toe mchezo
mchezo huu umetengenezwa kwa chatu hiyo ni lugha ya kompyuta
nimetumia mhariri wa chatu kuitwa: pycharm unaweza pia kutumia mhariri wa msimbo wa chatu wa kawaida pia
Hatua ya 1: Ingiza
kutoka kwa kuingiza tkinter *
Hatua ya 2: Mizizi
mzizi = Tk ()
kichwa cha kichwa ("3T TIC TAC TOE") # Kichwa
maandishi = Kuingia (mzizi, fonti = ("ds-digital", 15)) maandishi.pack (kujaza = X, padx = 5, pady = 5, ipadx = 5, ipady = 5) # Nakala
bodi = ["-", "-", "-", "-", "-", "-", "-", "-", "-"] # Bodi
Hatua ya 3: Kazi Baada ya Kuweka Katika Mhariri Inaonyesha Maonyo Bonyeza Warrnigs na Uipe Assambel Yote
# Kazi
mchezaji = "X" button = stop_game = Uongo stop_game_tie = Uongo
def Turn (): # Uchapishaji Zima maandishi delete (0, END) text.insert (0, "{} 'S TURN".format (player))
def Exit (): root.destroy () exit ()
def Game_Over (): # Chech ikiwa mchezo umeisha Check_Winner ()
ikiwa stop_game == Kweli: Hplayer () text.delete (0, END) text.insert (0, "'{}' WINNER".format (player))
kingine: Check_Tie ()
ikiwa stop_game_tie == Kweli: text.delete (0, END) text.insert (0, "TIE MATCH")
def Check_Winner (): # Angalia ikiwa kuna mshindi wa kimataifa stop_game
row_1 = bodi [0] == bodi [1] == bodi [2]! = "-" row_2 = bodi [3] == bodi [4] == bodi [5]! = "-" row_3 = bodi [6] == bodi [7] == bodi [8]! = "-" ikiwa row_1 au row_2 au row_3: stop_game = True
column_1 = bodi [0] == bodi [3] == bodi [6]! = "-" column_2 = bodi [1] == bodi [4] == bodi [7]! = "-" column_3 = bodi [2] == bodi [5] == bodi [8]! = "-" ikiwa safu_1 au safu_2 au safu_3: stop_game = Kweli
diagonal_1 = bodi [0] == bodi [4] == bodi [8]! = "-" diagonal_2 = bodi [2] == bodi [4] == bodi [6]! = "-" ikiwa diagonal_1 au diagonal_2: stop_game = Kweli
def Check_Tie (): # Angalia ikiwa ni mechi inayolingana ya kimataifa stop_game_tie
ikiwa "-" sio kwenye bodi: stop_game_tie = Kweli
def Hplayer (): # Kusimamia Badilisha mchezaji wa ulimwengu
ikiwa mchezaji == "X": mchezaji = "O"
mwingine: mchezaji = "X"
def Add_Text (pos, play): # Ongeza Nakala kifungo cha ulimwengu
ikiwa pos sio kwenye kifungo na stop_game == Uongo na stop_game_tie == Uongo na pos! = 9: Geuza ()
def_buttons [pos].configure (text = play) board [pos] = mchezaji
kifungo. tumia (pos) Hplayer () Turn () Game_Over ()
Hatua ya 4: Nambari ya Mwisho Itatoa Mwonekano wa Mwisho?
# GRID
def New_Match (): # Kitufe kipya cha Mechi Kazi ya bodi ya kimataifa mchezaji wa kimataifa kifungo cha kimataifa stop_game kimataifa stop_game_tie
kifungo_1.configure (text = "") button_2.configure (text = "") button_3.configure (text = "") button_4.configure (text = "") button_5.configure (text = "") button_6.configure (text = "") button_7.configure (text = "") button_8.configure (text = "") button_9.configure (text = "") board = ["-", "-", "-", "-", "-", "-", "-", "-", "-"] player = "X" button = stop_game = Uongo stop_game_tie = Uongo wa Uongo ()
# Vifungo
Pinduka ()
fremu = fremu (mzizi) fremu. pakiti (upande = TOP, nanga = NW)
fremu1 = fremu (fremu) fremu1 pakiti ()
kifungo_1 = Kifungo (fremu1, maandishi = "", upana = 8, urefu = 3, amri = lambda: Add_Text (0, mchezaji), bg = 'pink') button_1.pack (side = LEFT)
kifungo_2 = Kifungo (fremu1, maandishi = "", upana = 8, urefu = 3, amri = lambda: Ongeza_Text (1, kichezaji), bg = 'pink') kifungo_2.pack (side = LEFT)
kifungo_3 = Kifungo (fremu1, maandishi = "", upana = 8, urefu = 3, amri = lambda: Ongeza_Text (2, kichezaji), bg = 'pink') button_3.pack (side = LEFT)
fremu2 = fremu (fremu) fremu2.pack ()
button_4 = Button (frame2, text = "", width = 8, height = 3, command = lambda: Add_Text (3, player), bg = 'blue') button_4.pack (side = LEFT)
button_5 = Button (frame2, text = "", width = 8, height = 3, command = lambda: Add_Text (4, player), bg = 'blue') button_5.pack (side = LEFT)
button_6 = Button (frame2, text = "", width = 8, height = 3, command = lambda: Add_Text (5, player), bg = 'blue') button_6.pack (side = LEFT)
fremu3 = fremu (fremu) fremu3.pack ()
button_7 = Button (frame3, text = "", width = 8, height = 3, command = lambda: Add_Text (6, player), bg = 'orange') button_7.pack (side = LEFT)
button_8 = Button (frame3, text = "", width = 8, height = 3, command = lambda: Add_Text (7, player), bg = 'orange') button_8.pack (side = LEFT)
button_9 = Button (frame3, text = "", width = 8, height = 3, command = lambda: Add_Text (8, player), bg = 'machungwa') button_9.pack (side = LEFT)
fremu4 = fremu (fremu) fremu4.pack ()
button_clear = Button (frame4, text = "MECHI MPYA", width = 13, height = 3, command = lambda: New_Match (), bg = 'violet', foreground = 'red') button_clear.pack (side = LEFT)
exit_button = Button (frame4, text = "EXIT", width = 12, height = 3, command = lambda: Exit (), bg = 'green', foreground = 'orange') exit_button.pack (side = LEFT)
def_buttons = [button_1, button_2, button_3, button_4, button_5, button_6, button_7, button_8, button_9]
mzizi. kitanzi ()
Ilipendekeza:
Mchezo wa Arduino Touch Tic Tac Toe: Hatua 6 (na Picha)
Mchezo wa Arduino Touch Tic Tac Toe: Wapendwa marafiki karibu kwenye mafunzo mengine ya Arduino! Katika mafunzo haya ya kina tutaunda mchezo wa Arduino Tic Tac Toe. Kama unavyoona, tunatumia skrini ya kugusa na tunacheza dhidi ya kompyuta. Mchezo rahisi kama Tic Tac Toe ni
Mchezo wa Elektroniki wa Tic-Tac-Toe kwenye Sanduku la Mbao: Hatua 5
Mchezo wa Elektroniki wa Tic-Tac-Toe kwenye Sanduku la Mbao: HelloNinaanzisha mchezo wa kuchekesha wa Tic-Tac-Toe katika toleo jipya. Nilitafuta wavuti kwa mradi kama huo, lakini wazo hapa ni la kipekee. NINATUMAINI:) Kwa hivyo hebu anza sasa
Mchezo wa Microbit Tic Tac Toe: Hatua 4 (na Picha)
Mchezo wa Microbit Tic Tac Toe: Kwa mradi huu, mfanyakazi mwenzangu - @descartez na mimi tuliunda mchezo mzuri wa toe tac kwa kutumia utendaji wa redio wa vijidudu. Ikiwa haujasikia juu ya vijidudu hapo awali, ni mdhibiti mzuri sana iliyoundwa iliyoundwa kufundisha programu za watoto. Wao
Mchezo wa 3D4x: 3D 4x4x4 Tic-Tac-Toe: Hatua 5 (na Picha)
Mchezo wa 3D4x: 3D 4x4x4 Tic-Tac-Toe: Je! Umechoka kucheza sawa, ya zamani, ya kuchosha, 2-dimensional tic-tac-toe? Kweli tuna suluhisho kwako! Tic-tac-toe katika vipimo-3 !!! Kwa wachezaji 2, kwenye mchemraba huu wa 4x4x4, pata taa za 4 mfululizo (kwa mwelekeo wowote) na ushinde! Unaifanya. Unaandika
Jinsi ya Kutengeneza Mchezo wa Tic Tac Toe Kutumia Mwepesi na Xcode: Hatua 5
Jinsi ya Kutengeneza Mchezo wa Tic Tac Toe Kutumia Swift na Xcode: Katika mafunzo haya ya Swift nitakuonyesha jinsi ya kuunda App ya Tic Tac Toe. Programu hii ni rahisi sana na ni mradi mzuri kwa Kompyuta yoyote. Nitavunja mafunzo katika hatua tatu: 1. Kuunda vitu2. Kuunganisha vitu kwenye nambari3. C