June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,31 @@
# Project : Pig the dice game
# Date : 2017/10/31
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
numPlayers = 2
maxScore = 100
safescore = list(numPlayers)
while true
rolling = ""
for player = 1 to numPlayers
score = 0
while safeScore[player] < maxScore
see "Player " + player + " Rolling? (Y) "
give rolling
if upper(rolling) = "Y"
rolled = random(5) + 1
see "Player " + player + " rolled " + rolled + nl
if rolled = 1
see "Bust! you lose player " + player + " but still keep your previous score of " + safeScore[player] + nl
exit
ok
score = score + rolled
else
safeScore[player] = safeScore[player] + score
ok
end
next
end
see "Player " + player + " wins with a score of " + safeScore[player]

View file

@ -0,0 +1,50 @@
Option Explicit
Sub Main_Pig()
Dim Scs() As Byte, Ask As Integer, Np As Boolean, Go As Boolean
Dim Cp As Byte, Rd As Byte, NbP As Byte, ScBT As Byte
'You can adapt these Const, but don't touch the "¤¤¤¤"
Const INPTXT As String = "Enter number of players : "
Const INPTITL As String = "Numeric only"
Const ROL As String = "Player ¤¤¤¤ rolls the die."
Const MSG As String = "Do you want to ""hold"" : "
Const TITL As String = "Total if you keep : "
Const RES As String = "The die give you : ¤¤¤¤ points."
Const ONE As String = "The die give you : 1 point. Sorry!" & vbCrLf & "Next player."
Const WIN As String = "Player ¤¤¤¤ win the Pig Dice Game!"
Const STW As Byte = 100
Randomize Timer
NbP = Application.InputBox(INPTXT, INPTITL, 2, Type:=1)
ReDim Scs(1 To NbP)
Cp = 1
Do
ScBT = 0
Do
MsgBox Replace(ROL, "¤¤¤¤", Cp)
Rd = Int((Rnd * 6) + 1)
If Rd > 1 Then
MsgBox Replace(RES, "¤¤¤¤", Rd)
ScBT = ScBT + Rd
If Scs(Cp) + ScBT >= STW Then
Go = True
Exit Do
End If
Ask = MsgBox(MSG & ScBT, vbYesNo, TITL & Scs(Cp) + ScBT)
If Ask = vbYes Then
Scs(Cp) = Scs(Cp) + ScBT
Np = True
End If
Else
MsgBox ONE
Np = True
End If
Loop Until Np
If Not Go Then
Np = False
Cp = Cp + 1
If Cp > NbP Then Cp = 1
End If
Loop Until Go
MsgBox Replace(WIN, "¤¤¤¤", Cp)
End Sub