Compare commits
2 Commits
fa2f9f1e2b
...
027b6795d4
Author | SHA1 | Date | |
---|---|---|---|
027b6795d4 | |||
|
eb32552f90 |
94
main.XML
Normal file
94
main.XML
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Biblioteka>
|
||||
<magazyn>
|
||||
<polka1 magazyn="matematyka">
|
||||
<ksieżka1>
|
||||
<title>matematyka</title>
|
||||
<autor>Gau Kozkowski</autor>
|
||||
<year>2018</year>
|
||||
</ksieżka1>
|
||||
<ksieżka2>
|
||||
<title>matematyka</title>
|
||||
<autor>marina Kozkowska</autor>
|
||||
<year>2019</year>
|
||||
</ksieżka2>
|
||||
<ksieżka3>
|
||||
<title>matematyka</title>
|
||||
<autor>Kristyna Pifagorska</autor>
|
||||
<year>2022</year>
|
||||
</ksieżka3>
|
||||
</polka1>
|
||||
<polka2 magazyn="fizyka">
|
||||
<ksieżka1>
|
||||
<title>fizyka</title>
|
||||
<autor>Gau Kozlowski</autor>
|
||||
<year>2001</year>
|
||||
</ksieżka1>
|
||||
<ksieżka2>
|
||||
<title>fizyka</title>
|
||||
<autor>Grzegorg Kozlewski</autor>
|
||||
<year>2000</year>
|
||||
</ksieżka2>
|
||||
<ksieżka3>
|
||||
<title>fizyka</title>
|
||||
<autor>Katarzyna Tomaszowska</autor>
|
||||
<year>2004</year>
|
||||
</ksieżka3>
|
||||
</polka2>
|
||||
<polka3 magazyn="filosofia">
|
||||
<ksieżka1>
|
||||
<title>filosofia</title>
|
||||
<autor>Tomasz Fryzerowski</autor>
|
||||
<year>2001</year>
|
||||
</ksieżka1>
|
||||
<ksieżka2>
|
||||
<title>filosofia</title>
|
||||
<autor>Timur Geroi</autor>
|
||||
<year>2024</year>
|
||||
</ksieżka2>
|
||||
<ksieżka3>
|
||||
<title>filosofia</title>
|
||||
<autor>Tomasz Fryzerowski</autor>
|
||||
<year>2001</year>
|
||||
</ksieżka3>
|
||||
</polka3>
|
||||
</magazyn>
|
||||
<magazyn1>
|
||||
<polka1 magazyn1="matematyka">
|
||||
<ksieżka1>
|
||||
<title>matematyka</title>
|
||||
<autor>Mariusz Figurowski</autor>
|
||||
<year>2099</year>
|
||||
</ksieżka1>
|
||||
</polka1>
|
||||
<polka2 magazyn1="fizyka">
|
||||
<ksieżka1>
|
||||
<title>fizyka</title>
|
||||
<autor>Grzegorg Królewski</autor>
|
||||
<year>2020</year>
|
||||
</ksieżka1>
|
||||
<ksieżka2>
|
||||
<title>fizyka</title>
|
||||
<autor>Renata Dialogowska</autor>
|
||||
<year>2018</year>
|
||||
</ksieżka2>
|
||||
</polka2>
|
||||
<polka3 magazyn1="filosofia">
|
||||
<ksieżka1>
|
||||
<title>filosofia</title>
|
||||
<autor>Tomasz Frendszip</autor>
|
||||
<year>2050</year>
|
||||
</ksieżka1>
|
||||
<ksieżka2>
|
||||
<title>filosofia</title>
|
||||
<autor>Tigr Lewski</autor>
|
||||
<year>2005</year>
|
||||
</ksieżka2>
|
||||
<ksieżka3>
|
||||
<title>filosofia</title>
|
||||
<autor>Reka Terowska</autor>
|
||||
<year>2001</year>
|
||||
</ksieżka3>
|
||||
</polka3>
|
||||
</magazyn1>
|
||||
</Biblioteka>
|
13
main.py
Normal file
13
main.py
Normal file
@ -0,0 +1,13 @@
|
||||
a = int(input())
|
||||
b = []
|
||||
|
||||
|
||||
for i in range(a):
|
||||
c = int(input())
|
||||
b.append(c)
|
||||
|
||||
m1 = min(b)
|
||||
m2 = max(b)
|
||||
|
||||
wyn = m1 * m2
|
||||
print(wyn)
|
82
main.yaml
Normal file
82
main.yaml
Normal file
@ -0,0 +1,82 @@
|
||||
- recipe_id: 1
|
||||
name: "Frykadelki w sosie cebulowym"
|
||||
ingredients:
|
||||
- name: "mięso mielone wołowo-wieprzowe"
|
||||
quantity: "500g"
|
||||
- name: "cebula"
|
||||
quantity: "3 szt."
|
||||
- name: "bułka tarta"
|
||||
quantity: "100g"
|
||||
- name: "jajko"
|
||||
quantity: "1 szt."
|
||||
- name: "natka pietruszki"
|
||||
quantity: "1 pęczek"
|
||||
- name: "Przyprawa do mięsa mielonego"
|
||||
quantity: "1 opakowanie"
|
||||
- name: "olej roślinny do smażenia"
|
||||
quantity: "3 łyżki"
|
||||
- name: "słodka śmietanka"
|
||||
quantity: "3 łyżki"
|
||||
- name: "piwo jęczmienne"
|
||||
quantity: "100 mililitrów"
|
||||
preparation_steps:
|
||||
- "Dwie cebule pokrój w plastry, a trzecią a zetrzyj na tarce. Posiekaj natkę pietruszki."
|
||||
- "Mięso mielone połącz z jajkiem, z 80g bułki tartej, z startą cebulą oraz natką pietruszki. Całość dopraw do smaku Przyprawą do mięsa mielonego Knorr, by danie było wyraziste w smaku."
|
||||
- "Z gotowego farszu uformuj małe kulki, obtocz je w pozostałej bułce tartej, spłaszcz i usmaż z obu stron na rozgrzanym oleju."
|
||||
- "Kotleciki przełóż na bok. Na patelnię wrzuć cebulę i smaż, aż delikatnie się zarumieni. Dodaj wtedy szklankę piwa. Powstały wywar wymieszaj ze śmietaną pomieszaną z jedną łyżką mąki. Na patelnię włóż kotleciki i duś je pod przykryciem przez ok. 5 minut."
|
||||
time: "30 minut"
|
||||
servings: 4
|
||||
cuisine: "Włoska"
|
||||
|
||||
- recipe_id: 2
|
||||
name: "Zupa pomidorowa"
|
||||
ingredients:
|
||||
- name: "pomidory"
|
||||
quantity: "1kg"
|
||||
- name: "cebula"
|
||||
quantity: "1 szt."
|
||||
- name: "marchew"
|
||||
quantity: "2 szt."
|
||||
- name: "bulion warzywny"
|
||||
quantity: "1 litr"
|
||||
- name: "śmietana"
|
||||
quantity: "100ml"
|
||||
preparation_steps:
|
||||
- "Pokrój cebulę i marchew, podsmaż je na oliwie."
|
||||
- "Dodaj pokrojone pomidory i bulion, gotuj przez 20 minut."
|
||||
- "Zblenduj zupę, a następnie dodaj śmietanę."
|
||||
time: "40 minut"
|
||||
servings: 4
|
||||
cuisine: "Polska"
|
||||
|
||||
- recipe_id: 3
|
||||
name: "Ciastka z budyniem"
|
||||
ingredients:
|
||||
- name: "mąka pszenna"
|
||||
quantity: "400g"
|
||||
- name: "masło"
|
||||
quantity: "200 gramów."
|
||||
- name: "cukier puder"
|
||||
quantity: "40 gramów."
|
||||
- name: "jajko"
|
||||
quantity: "3 szt."
|
||||
- name: "sól"
|
||||
quantity: "3 sztuki"
|
||||
- name: "budyń śmietankowy"
|
||||
quantity: "1 opakowanie"
|
||||
- name: "mleko"
|
||||
quantity: "0.5 litra"
|
||||
- name: "cukier"
|
||||
quantity: "40 gramów"
|
||||
- name: "cukier puder do podsypania"
|
||||
quantity: "1 łyżeczka"
|
||||
preparation_steps:
|
||||
- "Mąkę wraz z cukrem pudrem przesiewamy do miski. Dodajemy sól oraz pokrojone na kawałki zimne masło. Siekamy nożem, aż powstanie kruszonka. Następnie dodajemy żółtka i zagniatamy ciasto. Formujemy z niego kulę. Owijamy folią i wkładamy na 30 min do lodówki."
|
||||
- "Odlewamy 1/4 mleka i mieszamy w nim budyń wraz z cukrem. Pozostałe mleko podgrzewamy i gdy się zagotuje wlewamy budyniową masę. Energicznie mieszamy, aż budyń stanie się gęsty i klarowny. Pod koniec dodajemy łyżkę masła i ponownie mieszamy. Pozostawiamy do przestudzenia."
|
||||
- "Ciasto rozwałkowujemy z odrobiną mąki. Wykrawamy okręgi jedne większe, drugie mniejsze."
|
||||
- "Umieszczamy je w foremkach na tarteletki lub papierowych kokilkach (wówczas najlepiej użyć kilku kokilek na jedną babeczkę)."
|
||||
- "Do środka wlewamy po łyżce budyniu."
|
||||
- "Z wierzchu przykrywamy mniejszym okręgiem z ciasta. Pieczemy ciastka ok. 25-30 min w temperaturze 180 C. Po upieczeniu posypujemy cukrem pudrem."
|
||||
time: "90 minut"
|
||||
servings: 8
|
||||
cuisine: "Francuska"
|
197
main2.py
Normal file
197
main2.py
Normal file
@ -0,0 +1,197 @@
|
||||
# Pam Qian 2016 Fall CS 112 Python Midterm Project II
|
||||
# Tic Tack Toe
|
||||
|
||||
def main():
|
||||
# The main function
|
||||
introduction = intro()
|
||||
board = create_grid()
|
||||
pretty = printPretty(board)
|
||||
symbol_1, symbol_2 = sym()
|
||||
full = isFull(board, symbol_1, symbol_2) # The function that starts the game is also in here.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def intro():
|
||||
# This function introduces the rules of the game Tic Tac Toe
|
||||
print("Hello! Welcome to Pam's Tic Tac Toe game!")
|
||||
print("\n")
|
||||
print("Rules: Player 1 and player 2, represented by X and O, take turns "
|
||||
"marking the spaces in a 3*3 grid. The player who succeeds in placing "
|
||||
"three of their marks in a horizontal, vertical, or diagonal row wins.")
|
||||
print("\n")
|
||||
input("Press enter to continue.")
|
||||
print("\n")
|
||||
|
||||
|
||||
|
||||
def create_grid():
|
||||
# This function creates a blank playboard
|
||||
print("Here is the playboard: ")
|
||||
board = [[" ", " ", " "],
|
||||
[" ", " ", " "],
|
||||
[" ", " ", " "]]
|
||||
return board
|
||||
|
||||
|
||||
|
||||
def sym():
|
||||
# This function decides the players' symbols
|
||||
symbol_1 = input("Player 1, do you want to be X or O? ")
|
||||
if symbol_1 == "X":
|
||||
symbol_2 = "O"
|
||||
print("Player 2, you are O. ")
|
||||
else:
|
||||
symbol_2 = "X"
|
||||
print("Player 2, you are X. ")
|
||||
input("Press enter to continue.")
|
||||
print("\n")
|
||||
return (symbol_1, symbol_2)
|
||||
|
||||
|
||||
|
||||
def startGamming(board, symbol_1, symbol_2, count):
|
||||
# This function starts the game.
|
||||
|
||||
# Decides the turn
|
||||
if count % 2 == 0:
|
||||
player = symbol_1
|
||||
elif count % 2 == 1:
|
||||
player = symbol_2
|
||||
print("Player "+ player + ", it is your turn. ")
|
||||
row = int(input("Pick a row:"
|
||||
"[upper row: enter 0, middle row: enter 1, bottom row: enter 2]:"))
|
||||
column = int(input("Pick a column:"
|
||||
"[left column: enter 0, middle column: enter 1, right column enter 2]"))
|
||||
|
||||
|
||||
# Check if players' selection is out of range
|
||||
while (row > 2 or row < 0) or (column > 2 or column < 0):
|
||||
outOfBoard(row, column)
|
||||
row = int(input("Pick a row[upper row:"
|
||||
"[enter 0, middle row: enter 1, bottom row: enter 2]:"))
|
||||
column = int(input("Pick a column:"
|
||||
"[left column: enter 0, middle column: enter 1, right column enter 2]"))
|
||||
|
||||
# Check if the square is already filled
|
||||
while (board[row][column] == symbol_1)or (board[row][column] == symbol_2):
|
||||
filled = illegal(board, symbol_1, symbol_2, row, column)
|
||||
row = int(input("Pick a row[upper row:"
|
||||
"[enter 0, middle row: enter 1, bottom row: enter 2]:"))
|
||||
column = int(input("Pick a column:"
|
||||
"[left column: enter 0, middle column: enter 1, right column enter 2]"))
|
||||
|
||||
# Locates player's symbol on the board
|
||||
if player == symbol_1:
|
||||
board[row][column] = symbol_1
|
||||
|
||||
else:
|
||||
board[row][column] = symbol_2
|
||||
|
||||
return (board)
|
||||
|
||||
|
||||
|
||||
def isFull(board, symbol_1, symbol_2):
|
||||
count = 1
|
||||
winner = True
|
||||
# This function check if the board is full
|
||||
while count < 10 and winner == True:
|
||||
gaming = startGamming(board, symbol_1, symbol_2, count)
|
||||
pretty = printPretty(board)
|
||||
|
||||
if count == 9:
|
||||
print("The board is full. Game over.")
|
||||
if winner == True:
|
||||
print("There is a tie. ")
|
||||
|
||||
# Check if here is a winner
|
||||
winner = isWinner(board, symbol_1, symbol_2, count)
|
||||
count += 1
|
||||
if winner == False:
|
||||
print("Game over.")
|
||||
|
||||
# This is function gives a report
|
||||
report(count, winner, symbol_1, symbol_2)
|
||||
|
||||
|
||||
|
||||
def outOfBoard(row, column):
|
||||
# This function tells the players that their selection is out of range
|
||||
print("Out of boarder. Pick another one. ")
|
||||
|
||||
|
||||
|
||||
def printPretty(board):
|
||||
# This function prints the board nice!
|
||||
rows = len(board)
|
||||
cols = len(board)
|
||||
print("---+---+---")
|
||||
for r in range(rows):
|
||||
print(board[r][0], " |", board[r][1], "|", board[r][2])
|
||||
print("---+---+---")
|
||||
return board
|
||||
|
||||
|
||||
|
||||
def isWinner(board, symbol_1, symbol_2, count):
|
||||
# This function checks if any winner is winning
|
||||
winner = True
|
||||
# Check the rows
|
||||
for row in range (0, 3):
|
||||
if (board[row][0] == board[row][1] == board[row][2] == symbol_1):
|
||||
winner = False
|
||||
print("Player " + symbol_1 + ", you won!")
|
||||
|
||||
elif (board[row][0] == board[row][1] == board[row][2] == symbol_2):
|
||||
winner = False
|
||||
print("Player " + symbol_2 + ", you won!")
|
||||
|
||||
|
||||
# Check the columns
|
||||
for col in range (0, 3):
|
||||
if (board[0][col] == board[1][col] == board[2][col] == symbol_1):
|
||||
winner = False
|
||||
print("Player " + symbol_1 + ", you won!")
|
||||
elif (board[0][col] == board[1][col] == board[2][col] == symbol_2):
|
||||
winner = False
|
||||
print("Player " + symbol_2 + ", you won!")
|
||||
|
||||
# Check the diagnoals
|
||||
if board[0][0] == board[1][1] == board[2][2] == symbol_1:
|
||||
winner = False
|
||||
print("Player " + symbol_1 + ", you won!")
|
||||
|
||||
elif board[0][0] == board[1][1] == board[2][2] == symbol_2:
|
||||
winner = False
|
||||
print("Player " + symbol_2 + ", you won!")
|
||||
|
||||
elif board[0][2] == board[1][1] == board[2][0] == symbol_1:
|
||||
winner = False
|
||||
print("Player " + symbol_1 + ", you won!")
|
||||
|
||||
elif board[0][2] == board[1][1] == board[2][0] == symbol_2:
|
||||
winner = False
|
||||
print("Player " + symbol_2 + ", you won!")
|
||||
|
||||
return winner
|
||||
|
||||
|
||||
|
||||
def illegal(board, symbol_1, symbol_2, row, column):
|
||||
print("The square you picked is already filled. Pick another one.")
|
||||
|
||||
|
||||
def report(count, winner, symbol_1, symbol_2):
|
||||
print("\n")
|
||||
input("Press enter to see the game summary. ")
|
||||
if (winner == False) and (count % 2 == 1 ):
|
||||
print("Winner : Player " + symbol_1 + ".")
|
||||
elif (winner == False) and (count % 2 == 0 ):
|
||||
print("Winner : Player " + symbol_2 + ".")
|
||||
else:
|
||||
print("There is a tie. ")
|
||||
|
||||
# Call Main
|
||||
main()
|
43
mainRU.XML
Normal file
43
mainRU.XML
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
|
||||
<xs:element name="RootElement">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="A" minOccurs="1" maxOccurs="unbounded"/>
|
||||
<xs:choice>
|
||||
<xs:sequence>
|
||||
<xs:element name="B" minOccurs="1"/>
|
||||
<xs:element name="C" minOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
||||
<xs:element name="RootElement2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="A" minOccurs="3" maxOccurs="unbounded"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
||||
<xs:element name="RootElement3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="A" minOccurs="1"/>
|
||||
<xs:choice>
|
||||
<xs:element name="A"/>
|
||||
<xs:element name="B"/>
|
||||
</xs:choice>
|
||||
<xs:element name="A" minOccurs="1"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
||||
</xs:schema>
|
196
mainRU1.XML
Normal file
196
mainRU1.XML
Normal file
@ -0,0 +1,196 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
|
||||
<xs:element name="Biblioteka">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="magazyn">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="polka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ksieżka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="polka2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ksieżka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="polka3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ksieżka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="magazyn1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="polka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ksieżka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="polka2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ksieżka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="polka3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ksieżka1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="ksieżka3">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="title" type="xs:string"/>
|
||||
<xs:element name="autor" type="xs:string"/>
|
||||
<xs:element name="year" type="xs:int"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
|
||||
</xs:schema>
|
72
prywet.py
Normal file
72
prywet.py
Normal file
@ -0,0 +1,72 @@
|
||||
import random
|
||||
|
||||
def Tablica(plansza):
|
||||
print(f"{plansza[0]} | {plansza[1]} | {plansza[2]}")
|
||||
print("---------")
|
||||
print(f"{plansza[3]} | {plansza[4]} | {plansza[5]}")
|
||||
print("---------")
|
||||
print(f"{plansza[6]} | {plansza[7]} | {plansza[8]}")
|
||||
|
||||
def Wygrano(plansza, gracz):
|
||||
kombinacje = [
|
||||
[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [6, 4, 2]
|
||||
]
|
||||
for kombo in kombinacje:
|
||||
if plansza[kombo[0]] == plansza[kombo[1]] == plansza[kombo[2]] == gracz:
|
||||
return True
|
||||
return False
|
||||
|
||||
def sprawdz_remis(plansza):
|
||||
return ' ' not in plansza
|
||||
|
||||
print("Zegramy!!!")
|
||||
gracz1 = input("Gracz 1, wybierz swój symbol (x/o): ")
|
||||
gracz2 = 'o' if gracz1 == 'x' else 'x'
|
||||
|
||||
while gracz1 not in ['x', 'o']:
|
||||
print("Nie ten symbol. Wybierz poprawny")
|
||||
gracz1 = input("Gracz 1, wybierz swój symbol (x/o): ")
|
||||
|
||||
print(f"Gracz 1 gra jako ({gracz1}), a gracz 2 gra jako ({gracz2})")
|
||||
raund = random.choice([1, 2])
|
||||
if raund == 1:
|
||||
print("Gracz 1 zaczyna grę")
|
||||
else:
|
||||
print("Gracz 2 zaczyna grę")
|
||||
|
||||
plansza = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||
tur = 1
|
||||
|
||||
while True:
|
||||
Tablica(plansza)
|
||||
|
||||
if tur == 1:
|
||||
gracz = gracz1
|
||||
tur = 2
|
||||
else:
|
||||
gracz = gracz2
|
||||
tur = 1
|
||||
|
||||
while True:
|
||||
try:
|
||||
wybor = int(input(f"Gracz {gracz}, wybierz pole (1-9): "))
|
||||
if wybor < 1 or wybor > 9:
|
||||
print("Nieprawidłowy numer pola. Wybierz pole z zakresu 1-9.")
|
||||
elif plansza[wybor - 1] in ['x', 'o']:
|
||||
print("To pole jest już zajęte. Wybierz inne pole.")
|
||||
else:
|
||||
break
|
||||
except ValueError:
|
||||
print("Proszę wprowadzić numer z zakresu 1-9.")
|
||||
|
||||
plansza[wybor - 1] = gracz
|
||||
|
||||
if Wygrano(plansza, gracz):
|
||||
Tablica(plansza)
|
||||
print(f"Gratulacje! Gracz {gracz} wygrał!")
|
||||
break
|
||||
|
||||
if sprawdz_remis(plansza):
|
||||
Tablica(plansza)
|
||||
print("Gra zakończona remisem!")
|
||||
break
|
1
repositorium
Submodule
1
repositorium
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit fa2f9f1e2b3338dc42ebae7d0d5324679ace41fb
|
Loading…
Reference in New Issue
Block a user