Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,39 @@
|
|||
Dim As Integer lado, jugador1, jugador2, total1, total2, cont, i
|
||||
Dim As Integer dado1 = 9, lado1 = 4
|
||||
Dim As Integer dado2 = 6, lado2 = 6
|
||||
|
||||
Randomize Timer
|
||||
|
||||
Function Lanzamiento(dado As Integer, lado As Integer) As Integer
|
||||
Dim As Short lanza, total
|
||||
|
||||
For lanza = 1 To dado
|
||||
total += Int(Rnd * lado) + 1
|
||||
Next lanza
|
||||
Return total
|
||||
End Function
|
||||
|
||||
For i = 0 To 1
|
||||
For cont = 1 To 100000
|
||||
jugador1 = Lanzamiento(dado1, lado1)
|
||||
jugador2 = Lanzamiento(dado2, lado2)
|
||||
If jugador1 > jugador2 Then
|
||||
total1 += 1
|
||||
Elseif jugador1 <> jugador2 Then
|
||||
total2 += 1
|
||||
End If
|
||||
Next cont
|
||||
|
||||
Print Using "Lanzado el dado & veces"; (cont - 1)
|
||||
Print "jugador1 con"; dado1; " dados de"; lado1; " lados"
|
||||
Print "jugador2 con"; dado2; " dados de"; lado2; " lados"
|
||||
Print Using "Total victorias jugador1 = & => #.#######"; total1; (total2 / total1)
|
||||
Print "Total victorias jugador2 ="; total2
|
||||
Print (cont - 1) - (total1 + total2); !" empates\n"
|
||||
|
||||
dado1 = 5: lado1 = 10
|
||||
dado2 = 6: lado2 = 7
|
||||
total1 = 0: total2 = 0
|
||||
Next i
|
||||
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue