------=_NextPart_000_004F_01BFCE5A.8F868700
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm a beginner and this is my first program. Anybody want to pick at it =
and help me do better? I also want to use the EX02.EXW example in Dave's =
Winlib to port this code in to so it'll run in winders[8*9 As of yet I =
don't know how. I'm also interested in using sprite graphics for dice.
-- Dice version 3 by
-- Joe Schwenk jschwenk at hsonline.net
-- Alvin Koffman ka9qlq at hotmail.com
-- with trace
-- trace(1)
include graphics.e -- include graphics
include get.e -- include keyboard imput
integer d1, d2, t, z, y, k -- declair some integers
procedure winner() -- CALL FOR WINNER
text_color(10) -- change text color
puts (1, "\n\t*****WINNER!!*****\n\t*****WINNER!!*****") -- display =
winner
y =3D 0 -- set loop to off
text_color (7) -- Set color back to normal
puts (1, "\n")
end procedure
procedure throw_dice() -- call this to throw dice
d1 =3D rand (6) -- throw dice
d2 =3D rand (6)
t =3D d1 + d2 -- total dice
text_color (12) -- change text color
puts (1, "\nDice 1 is: ") -- display results
print (1, d1)
puts (1, "\tDice 2 is: ")
print (1, d2)
puts (1, "\tDice total is: ")
print (1, t)
end procedure
procedure looser() -- call for looser
text_color (14) -- change text color
if -- is it snake eyes?
t =3D 2
then
puts (1, "\n\t*****SNAKE EYES TURKEY!!*****\n\t*****SNAKE EYES =
TURKEY!!*****")
else
text_color (5)
puts (1, "\n\t*****YAH BIG LOOSER!!*****\n\t*****YAH BIG =
LOOSER!!*****")
end if
y =3D 0 -- set loop to off
text_color (7) -- Set color back to normal
puts (1, "\n")
end procedure
procedure other_throws() -- keep trowing the dice
while -- multipel throw loop
y > 0
do
throw_dice() -- next throw
if -- check total for loose
t =3D 2
then
looser()
end if
if t =3D z -- check total for winner
then
winner()
end if
if -- check total for loose
t =3D 7
then
looser()
end if
if --check total for loose
t =3D 11
then
looser()
end if
end while -- end multipel throw loop
end procedure -- end next throw
procedure game()-- start game
throw_dice()
z =3D t -- keep to compair first throw with others
if -- did you win?
t =3D 7
then
winner()
end if
if -- did you win?
t =3D 11
then
winner()
end if
if -- did you loose?
t =3D 2
then
looser()
end if
other_throws() -- no 7 or 11? throw on
end procedure
=
----------------------------------------------------------------------
-- start program.
=
----------------------------------------------------------------------
y =3D 1 -- set other_throw loop to on
k =3D 121 -- set while play loop to on
while -- loop to check if you want to play
k =3D 121 -- ASCII for y
do
puts (1, "Play?") -- ask question
k =3D wait_key() -- wait for answer
if -- if not "y" then end program
k !=3D 121
then --set y to quit game
y =3D 0
else -- if "y" then start a game
y =3D 1 -- reset y and z for new game
z =3D 0
game() -- start game
end if
end while -- end check =20
http://ka9qlq.tripod.com/
------=_NextPart_000_004F_01BFCE5A.8F868700
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#a8c8f0>
<DIV><FONT face=3DArial size=3D2>I'm a beginner and this is my first =
program.=20
Anybody want to pick at it and help me do better? I also want to use the =
EX02.EXW example in Dave's Winlib to port this code in to so it'll run =
in=20
winders[8*9 As of yet I don't know how. I'm also interested in using =
sprite=20
graphics for dice.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
p; --=20
Dice version 3=20
by<BR> =
-- Joe=20
Schwenk <A=20
-- Alvin Koffman <A=20
nbsp; =20
-- with=20
p; =20
-- trace(1)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> include graphics.e -- =
include=20
graphics<BR> include get.e -- =
include=20
keyboard imput</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> integer d1, d2, t, z, y, =
k --=20
declair some integers</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> procedure winner() =
-- CALL FOR=20
WINNER<BR> text_color(10) -- =
change=20
text color<BR> puts (1,=20
"\n\t*****WINNER!!*****\n\t*****WINNER!!*****") -- display=20
winner<BR> y =3D=20
0 -- set loop to=20
off<BR> text_color (7) -- Set color back to=20
normal<BR> puts (1, "\n")</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> end =
procedure</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> procedure throw_dice() -- =
call this to=20
throw dice</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> d1 =3D rand=20
(6) -- throw=20
dice<BR> d2 =3D rand (6)<BR> t =3D =
d1 +=20
d2 -- total=20
dice<BR> text_color =
(12) =20
-- change text color<BR> puts (1, "\nDice 1 is: ") -- =
display=20
results<BR> print (1, d1)<BR> puts =
(1,=20
"\tDice 2 is: ")<BR> print (1, =
d2)<BR> puts=20
(1, "\tDice total is: ")<BR> print (1, t)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> end =
procedure</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> procedure looser() =
-- call for=20
looser<BR> text_color (14) -- =
change=20
text color<BR> =20
; =20
-- is it snake eyes?<BR> t =3D=20
2<BR> =
then<BR> =20
puts (1, "\n\t*****SNAKE EYES TURKEY!!*****\n\t*****SNAKE EYES=20
TURKEY!!*****")<BR> =
else<BR> =20
text_color (5)<BR> puts (1, =
"\n\t*****YAH=20
BIG LOOSER!!*****\n\t*****YAH BIG LOOSER!!*****")<BR> =
end=20
if<BR> y =3D=20
=20
-- set loop to off<BR> text_color =
(7) =20
-- Set color back to normal<BR> puts (1, =
"\n")</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> end procedure</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> procedure other_throws() =
-- keep=20
trowing the dice</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
bsp; =20
-- multipel throw loop<BR> y >=20
0<BR> do</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
throw_dice() -- =
next=20
throw</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
; =20
-- check total for loose<BR> t =3D=20
2<BR> =
then<BR> =20
looser()<BR> end if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> if t =3D z -- =
check total=20
for winner<BR> =20
then<BR> =
winner()<BR> end=20
if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
if -- =
check=20
total for loose<BR> t =3D=20
7<BR> =
then<BR> =20
looser()<BR> end if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
if =
--check=20
total for loose<BR> t =3D=20
11<BR> =20
then<BR> =
looser()<BR> end=20
if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> end=20
while -- end multipel throw =
loop<BR> =20
end procedure -- end next throw</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> procedure game()-- start=20
game<BR> throw_dice()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> z =3D=20
t -- keep to compair =
first throw=20
with others<BR> =20
if -- =
did you=20
win?<BR> t =3D =
7<BR> =20
then<BR> =
winner()<BR> end=20
if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
if -- =
did you=20
win?<BR> t =3D =
11<BR> =20
then<BR> winner()<BR> =
end=20
if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
if -- =
did you=20
loose?<BR> t =3D =
2<BR> =20
then<BR> =
looser()<BR> end=20
if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> other_throws() -- no 7 or =
11? throw=20
on</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> end procedure</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
----------------------------------------------------------------------<BR=
> =20
-- start program.<BR> =20
----------------------------------------------------------------------</F=
ONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> y =3D=20
1 -- set =
other_throw loop=20
to on<BR> k =3D =
121 -- set=20
while play loop to on</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
while -- loop to =
check if=20
you want to play<BR> k =3D=20
121 -- ASCII for=20
y<BR> do<BR> puts (1, "Play?") =
-- ask=20
question<BR> k =3D wait_key() -- =
wait for=20
answer<BR> =20
; =20
-- if not "y" then end program<BR> k !=3D=20
121<BR> =20
then =
--set y=20
to quit game<BR> y =3D 0<BR> =20
sp; =20
-- if "y" then start a game<BR> y =3D=20
1 -- =
reset y=20
and z for new game<BR> z =3D=20
0<BR> =20
game() -- start=20
game<BR> end if<BR> end=20
while -- end=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20
------=_NextPart_000_004F_01BFCE5A.8F868700--
|
Not Categorized, Please Help
|
|