10,000 : Demo 1
Here's a first demo for 10,000.
New
- "Graphical" Display
- Sorted Dice
- Detects 3, 4, and 5 of a kind.
It's a mess, yes I know.
—hartnell
screen 18, 32
width 80,60
color 0, rgb(255,255,255)
cls
const luCorner = chr(218)
const ruCorner = chr(191)
const tbBorder = chr(196)
const lrBorder = chr(179)
const lbCorner = chr(192)
const rbCorner = chr(217)
dim shared i as integer
dim shared a as integer
dim shared b as integer
type dieTP
value as integer
kept as integer
end type
dim shared dice(5) as dieTP
dim shared countFaces(6)
dim choice as string
dim shared dieFace(6,3) as string
dieFace(1,1) = " "
dieFace(1,2) = " * "
dieFace(1,3) = " "
dieFace(2,1) = "* "
dieFace(2,2) = " "
dieFace(2,3) = " *"
dieFace(3,1) = " *"
dieFace(3,2) = " * "
dieFace(3,3) = "* "
dieFace(4,1) = "* *"
dieFace(4,2) = " "
dieFace(4,3) = "* *"
dieFace(5,1) = "* *"
dieFace(5,2) = " * "
dieFace(5,3) = "* *"
dieFace(6,1) = "* *"
dieFace(6,2) = "* *"
dieFace(6,3) = "* *"
sub showTitle
print
print " ## ### ### ### ###"
print " # # # # # # # # #"
print " # # # # # # # # #"
print " # # # # # # # # #"
print " ### ### , ### ### ###"
print
print " A dice game by Phatty"
for i = 1 to 49
print "-";
next i
print
end sub
sub drawDie(x as integer, y as integer, die as dieTP, number as integer)
locate y, x
print " ";number;
if die.kept = 1 then color , rgb(200,200,200)
locate y + 1, x
print luCorner;tbBorder;tbBorder;tbBorder;ruCorner
locate y + 2, x
print lrBorder;dieFace(die.value,1);lrBorder
locate y + 3, x
print lrBorder;dieFace(die.value,2);lrBorder
locate y + 4, x
print lrBorder;dieFace(die.value,3);lrBorder
locate y + 5, x
print lbCorner;tbBorder;tbBorder;tbBorder;rbCorner
locate y + 6, x
color , rgb(255,255,255)
if die.kept = 1 then print " Kept"
end sub
sub resetDice
for i = 1 to 5
dice(i).value = 0
dice(i).kept = 0
next i
end sub
sub rollDice
for i = 1 to 5
if dice(i).kept = 0 then dice(i).value = int(rnd(1)*6)+1
next i
end sub
for i = 1 to 5
if dice(i).kept = 0 then dice(i).value = int(rnd(1)*6)+1
next i
sub sortDice
dim temp as dieTP
dim sorted
do
sorted = 0
for i = 1 to 4
if dice(i).value > dice(i+1).value then
temp = dice(i)
dice(i) = dice(i+1)
dice(i + 1) = temp
sorted = 1
end if
next i
loop until Sorted = 0
end sub
showTitle
print
print " 2.) Play"
do
choice = inkey
loop until choice = "1" or choice = "2"
resetDice
rollDice
sortDice
do
cls
showTitle
print
print " Your dice this roll are : "
for i = 1 to 5
drawDie(i*5,15,dice(i),i)
next i
locate 25,1
print "Press the number of the die you want to keep."
print "'r' to roll"
print "'e' to exit demo"
for i = 1 to 6
countFaces(i) = 0
next i
for a = 1 to 5
for b = 1 to 6
if dice(a).value = b then countFaces(b) = countFaces(b) + 1
next i
next a
print : print
print "Scoring Dice : "
print
for i = 1 to 6
if countFaces(i) = 5 then print "Five of a Kind in"; i ; "'s."
if countFaces(i) = 4 then print "Four of a Kind in"; i ; "'s."
if countFaces(i) = 3 then print "Three of a Kind in" ; i ; "'s."
next i
do
choice = inkey
loop until choice <> ""
if val(choice) > 0 and val(choice) < 6 then
if dice(val(choice)).kept = 1 then
dice(val(choice)).kept = 0
elseif dice(val(choice)).kept = 0 then
dice(val(choice)).kept = 1
end if
end if
if choice = "e" then end
if choice = "r" then
rollDice
sortDice
end if
loop




