Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:completed risk-risiko #147

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/ex6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from random import random
#giocatore 1 lancia 3 dadi

counterGiocatore1 = 0
counterGiocatore2 = 0

def gioco()->None:
k = int(random()*10)
z = int(random()*10)
y = int(random()*10)

giocatore1 = [k,z,y]

a = int(random()*10)
b = int(random()*10)
d = int(random()*10)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definisci una tua funzione random che esegua questa operazione random()*10


giocatore2 = [a,b,d]

global counterGiocatore1
global counterGiocatore2

print("Blue dices:")
print(k)
print(z)
print(y)

print("Red dices:")
print(a)
print(b)
print(d)

if giocatore1[0]>giocatore2[0]:
counterGiocatore1+=1
else:
counterGiocatore2+=1

if giocatore1[1]>giocatore2[1]:
counterGiocatore1+=1
else:
counterGiocatore2+=1

if giocatore1[2]>giocatore2[2]:
counterGiocatore1+=1
else:
counterGiocatore2+=1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aggiungi dei commenti per rendere più chiaro il codice.


gioco()
print("giocatore1 ha vinto") if counterGiocatore1>=counterGiocatore2 else print("giocatore2 ha vinto")


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potresti implementare qualche funzione

Loading