Spoof game: Difference between revisions

Spoof game in FreeBASIC
(Spoof game in FreeBASIC)
Line 196:
PLAYER 2 buys the drinks!
</pre>
 
=={{header|FreeBASIC}}==
{{trans|Julia}}
<lang freebasic>Function PideEntero(texto As String) As Integer
Dim As Integer mon
While true
Color 15: Print !"\n"; texto;
Input " (supply an integer) => ", mon
If (0 <= mon <= 6) Then Return mon
Wend
End Function
 
Sub ChinosParaDos
Dim As Integer olla, monedas(0 To 6)
Dim As Integer mi_olla = 0, mi_apuesta = 0, tu_olla = 0, tu_apuesta = 0
Dim As Integer numRondas = PideEntero("How many games do you want?")
For cont As Integer = 1 To numRondas
While true
mi_olla = Int(Rnd * 3)
mi_apuesta = Int(Rnd * 6)
If (mi_olla + 3) < mi_apuesta Then Exit While
Wend
Color 14: Print !"\nI have put my pot and guess."
Color 7
While true
tu_olla = PideEntero("Your pot?")
tu_apuesta = PideEntero("Your guess?")
If (0 <= tu_olla <= 6) And (0 <= tu_apuesta <= 6) And (tu_olla + 4 > tu_apuesta) Then Exit While
Wend
Print !"\nMy put is:"; mi_olla
Print "My guess is:"; mi_apuesta
olla = mi_olla + tu_olla
If (mi_apuesta = olla) And (tu_apuesta = olla) Then
Color 6: Print !"\nDraw!\n"
Elseif mi_apuesta = olla Then
Color 12: Print !"\nI won!\n"
Elseif tu_apuesta = olla Then
Color 9: Print !"\nYou won!\n"
Else
Color 13: Print !"\nNo winner!\n"
End If
Next cont
End Sub
 
Randomize Timer
Do
Cls
Color 11: Print !"Spoof game\n=========="
ChinosParaDos
Color 15: Print "Another round? (Press X to exit, or another key to continue)"
Loop Until (Ucase(Input(1)) = "X")
End</lang>
 
 
=={{header|Go}}==
2,130

edits