1. Gosh darn dag nab flabbergastrations!!!!!!!!

------=_NextPart_000_0005_01BFF4C5.E45E8E80
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Just when I think I might have a handle on this stuff my computer yells =
STUPID!!!
This code works, your a winner on 7 only, but look at the "if then" =
test. Uncomment the or statement, and your a winner on everything. This =
makes no sense!!!!! I'm no a smart man, but I (thought) know what an or =
is for. I know this isn't proper code but I'm just trying to "get" =
things right now.
Alvin=20

-- begin code

-- A simple Windows dice game


include win32lib.ew

without warning

------------------------------------------

-- CONTROLS:


constant WinDice =3D

create( Window, "Win Dice!", 0, Default, Default, 400, 200, 0 )


-- create a control in the window

constant Throw_Button =3D

create( PushButton, "&Throw Dice", WinDice, 100, 30, 80, 40, 0 )

----------------------------------------------

-- ACTIONS (things to do when initiating events occur):


-- action to take when the window opens

global procedure onPaint_WinDice( integer x1, integer y1, integer x2,
integer y2 )

setPosition(WinDice,1,1) -- sets initial position for text

wPuts( WinDice, "WinDice Version 1.0 Click the Throw dice button to =
play" )

end procedure

-- action to take when roll dice button pressed:

procedure RollDice()

integer d1,d2,dt

d1 =3D rand( 6 ) -- get dice values

d2 =3D rand( 6 )

dt =3D d1 + d2


repaintWindow(WinDice) -- clears screen so new numbers don't overwrite =
old

setPosition(WinDice,1,20) --sets position of first number

wPrint(WinDice,d1)

setPosition(WinDice,20,20)-- sets position of second number

wPrint(WinDice,d2)

setPosition(WinDice,40,20)-- sets position of second number

wPrint(WinDice,dt)

if dt =3D 7 -- or 11
      then
   setPosition(WinDice,1,50)
   wPuts (WinDice, "**WINNER***")
   end if
end procedure


-----------------------------------------------

-- EVENTS (tell Windows when to do an action & what action to do):

onPaint[WinDice] =3D routine_id( "onPaint_WinDice" )

onClick[Throw_Button]=3Droutine_id("RollDice")

-----------------------------------------------

-- MAIN LOOP:


-- hand control over to Windows

WinMain( WinDice, Normal )



-- end code
http://ka9qlq.tripod.com/

------=_NextPart_000_0005_01BFF4C5.E45E8E80
        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>Just when I think I might have a handle =
on this=20
stuff my computer yells STUPID!!!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>This code works, your&nbsp;a winner on =
7 only, but=20
look at the "if then" test. Uncomment the or statement, and your a =
winner on=20
everything. This makes no sense!!!!! I'm no a smart man, but I (thought) =
know=20
what an or is for. I know this isn't proper code but I'm just trying to =
"get"=20
things right now.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Alvin </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- begin code</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- A simple Windows dice =
game</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>include win32lib.ew</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>without warning</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- CONTROLS:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>constant WinDice =3D</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>create( Window, "Win Dice!", 0, =
Default, Default,=20
400, 200, 0 )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- create a control in the =
window</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>constant Throw_Button =3D</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>create( PushButton, "&amp;Throw Dice", =
WinDice,=20
100, 30, 80, 40, 0 )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- ACTIONS (things to do when =
initiating events=20
occur):</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- action to take when the window=20
opens</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>global procedure onPaint_WinDice( =
integer x1,=20
integer y1, integer x2,<BR>integer y2 )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>setPosition(WinDice,1,1) -- sets =
initial position=20
for text</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>wPuts( WinDice, "WinDice Version 1.0 =
Click the=20
Throw dice button to play" )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>end procedure</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- action to take when roll dice button =

pressed:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>procedure RollDice()</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>integer d1,d2,dt</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>d1 =3D rand( 6 ) -- get dice =
values</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>d2 =3D rand( 6 )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>dt =3D d1 + d2</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>repaintWindow(WinDice) -- clears =
screen so new=20
numbers don't overwrite old</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>setPosition(WinDice,1,20) --sets =
position of first=20
number</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>wPrint(WinDice,d1)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>setPosition(WinDice,20,20)-- sets =
position of=20
second number</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>wPrint(WinDice,d2)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>setPosition(WinDice,40,20)-- sets =
position of=20
second number</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>wPrint(WinDice,dt)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>if dt =3D 7 -- or=20
11<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<BR>&nbsp;&nbsp;=20
setPosition(WinDice,1,50)<BR>&nbsp;&nbsp; wPuts (WinDice,=20
"**WINNER***")<BR>&nbsp;&nbsp; end if<BR>end procedure</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20

<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- EVENTS (tell Windows when to do an =
action &amp;=20
what action to do):</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>onPaint[WinDice] =3D routine_id( =
"onPaint_WinDice"=20
)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- MAIN LOOP:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- hand control over to =
Windows</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>WinMain( WinDice, Normal )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>-- end code</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><A=20

------=_NextPart_000_0005_01BFF4C5.E45E8E80--

new topic     » topic index » view message » categorize

2. Re: Gosh darn dag nab flabbergastrations!!!!!!!!

------=_NextPart_000_028C_01BFF546.4E36E700
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

This is because=20

"if dt =3D 7 or 11"
is interpreted as=20
"if (dt =3D 7) or (11 !=3D 0)"   which is always true because 11 is =
always not equal tro zero

Instead, you might like to try
"if dt =3D 7 or dt =3D 11"

cheers,
Derek Parnell
dparnell at bigpond.net.au
Melbourne, Australia
  ----- Original Message -----=20
  From: A.R.S. Alvin Koffman=20
  To: EUPHORIA at LISTSERV.MUOHIO.EDU=20
  Sent: Monday, July 24 2000 07:48
  Subject: Gosh darn dag nab flabbergastrations!!!!!!!!


  Just when I think I might have a handle on this stuff my computer =
yells STUPID!!!
  This code works, your a winner on 7 only, but look at the "if then" =
test. Uncomment the or statement, and your a winner on everything. This =
makes no sense!!!!! I'm no a smart man, but I (thought) know what an or =
is for. I know this isn't proper code but I'm just trying to "get" =
things right now.
  Alvin=20
  =20
  -- begin code

  -- A simple Windows dice game


  include win32lib.ew

  without warning

  ------------------------------------------

  -- CONTROLS:


  constant WinDice =3D

  create( Window, "Win Dice!", 0, Default, Default, 400, 200, 0 )


  -- create a control in the window

  constant Throw_Button =3D

  create( PushButton, "&Throw Dice", WinDice, 100, 30, 80, 40, 0 )

  ----------------------------------------------

  -- ACTIONS (things to do when initiating events occur):


  -- action to take when the window opens

  global procedure onPaint_WinDice( integer x1, integer y1, integer x2,
  integer y2 )

  setPosition(WinDice,1,1) -- sets initial position for text

  wPuts( WinDice, "WinDice Version 1.0 Click the Throw dice button to =
play" )

  end procedure

  -- action to take when roll dice button pressed:

  procedure RollDice()

  integer d1,d2,dt

  d1 =3D rand( 6 ) -- get dice values

  d2 =3D rand( 6 )

  dt =3D d1 + d2


  repaintWindow(WinDice) -- clears screen so new numbers don't overwrite =
old

  setPosition(WinDice,1,20) --sets position of first number

  wPrint(WinDice,d1)

  setPosition(WinDice,20,20)-- sets position of second number

  wPrint(WinDice,d2)

  setPosition(WinDice,40,20)-- sets position of second number

  wPrint(WinDice,dt)

  if dt =3D 7 -- or 11
        then
     setPosition(WinDice,1,50)
     wPuts (WinDice, "**WINNER***")
     end if
  end procedure


  -----------------------------------------------

  -- EVENTS (tell Windows when to do an action & what action to do):

  onPaint[WinDice] =3D routine_id( "onPaint_WinDice" )

  onClick[Throw_Button]=3Droutine_id("RollDice")

  -----------------------------------------------

  -- MAIN LOOP:


  -- hand control over to Windows

  WinMain( WinDice, Normal )

  =20

  -- end code
  http://ka9qlq.tripod.com/

------=_NextPart_000_028C_01BFF546.4E36E700
        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.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#a8c8f0>
<DIV><FONT face=3DArial size=3D2>This is because </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2><STRONG>"if dt =3D 7 or 11"</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>is interpreted as </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT size=3D2><STRONG>"if (dt =3D 7) or (11 !=3D =
0)"&nbsp;&nbsp;</STRONG> which=20
is always true because 11 is always not equal tro zero</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>Instead, you might like to try</DIV>
<DIV>
<DIV><FONT size=3D2><STRONG>"if dt =3D 7 or dt =3D=20
11"</STRONG></FONT></DIV></DIV></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>cheers,<BR>Derek Parnell<BR><A=20
lbourne,=20
Australia</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A href=3D"mailto:ka9qlq at HOTMAIL.COM" =
title=3Dka9qlq at HOTMAIL.COM>A.R.S. Alvin=20
  Koffman</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20
  href=3D"mailto:EUPHORIA at LISTSERV.MUOHIO.EDU"=20
  title=3DEUPHORIA at LISTSERV.MUOHIO.EDU>EUPHORIA at LISTSERV.MUOHIO.EDU</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, July 24 2000 =
07:48</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Gosh darn dag nab=20
  flabbergastrations!!!!!!!!</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>Just when I think I might have a =
handle on this=20
  stuff my computer yells STUPID!!!</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>This code works, your&nbsp;a winner =
on 7 only,=20
  but look at the "if then" test. Uncomment the or statement, and your a =
winner=20
  on everything. This makes no sense!!!!! I'm no a smart man, but I =
(thought)=20
  know what an or is for. I know this isn't proper code but I'm just =
trying to=20
  "get" things right now.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Alvin </FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- begin code</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- A simple Windows dice =
game</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>include win32lib.ew</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>without warning</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>------------------------------------------</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- CONTROLS:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>constant WinDice =3D</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>create( Window, "Win Dice!", 0, =
Default, Default,=20
  400, 200, 0 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>-- create a control in the=20
window</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>constant Throw_Button =
=3D</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>create( PushButton, "&amp;Throw =
Dice", WinDice,=20
  100, 30, 80, 40, 0 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>----------------------------------------------</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- ACTIONS (things to do when =
initiating events=20
  occur):</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>-- action to take when the window =

  opens</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>global procedure onPaint_WinDice( =
integer x1,=20
  integer y1, integer x2,<BR>integer y2 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,1,1) -- sets =
initial position=20
  for text</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPuts( WinDice, "WinDice Version 1.0 =
Click the=20
  Throw dice button to play" )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>end procedure</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- action to take when roll dice =
button=20
  pressed:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>procedure RollDice()</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>integer d1,d2,dt</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>d1 =3D rand( 6 ) -- get dice =
values</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>d2 =3D rand( 6 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>dt =3D d1 + d2</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>repaintWindow(WinDice) -- clears =
screen so=20
  new numbers don't overwrite old</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,1,20) --sets =
position of=20
  first number</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPrint(WinDice,d1)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,20,20)-- sets =
position of=20
  second number</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPrint(WinDice,d2)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,40,20)-- sets =
position of=20
  second number</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPrint(WinDice,dt)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>if dt =3D 7 -- or=20
  11<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<BR>&nbsp;&nbsp;=20
  setPosition(WinDice,1,50)<BR>&nbsp;&nbsp; wPuts (WinDice,=20
  "**WINNER***")<BR>&nbsp;&nbsp; end if<BR>end procedure</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  =

  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- EVENTS (tell Windows when to do an =
action=20
  &amp; what action to do):</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>onPaint[WinDice] =3D routine_id( =
"onPaint_WinDice"=20
  )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>onClick[Throw_Button]=3Droutine_id("RollDice")</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>-----------------------------------------------</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- MAIN LOOP:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>-- hand control over to =
Windows</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>WinMain( WinDice, Normal =
)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- end code</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><A=20
  =

------=_NextPart_000_028C_01BFF546.4E36E700--

new topic     » goto parent     » topic index » view message » categorize

3. Re: Gosh darn dag nab flabbergastrations!!!!!!!!

------=_NextPart_000_0024_01BFF504.145EE1A0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I think you mean to test for:

If dt =3D 7 or dt =3D 11 then
    -- you win

Right?

  ----- Oorspronkelijk bericht -----=20
  Van: A.R.S. Alvin Koffman=20
  Aan: EUPHORIA at LISTSERV.MUOHIO.EDU=20
  Verzonden: zondag 23 juli 2000 23:48
  Onderwerp: Gosh darn dag nab flabbergastrations!!!!!!!!


  Just when I think I might have a handle on this stuff my computer =
yells STUPID!!!
  This code works, your a winner on 7 only, but look at the "if then" =
test. Uncomment the or statement, and your a winner on everything. This =
makes no sense!!!!! I'm no a smart man, but I (thought) know what an or =
is for. I know this isn't proper code but I'm just trying to "get" =
things right now.
  Alvin=20
  =20
  -- begin code

  -- A simple Windows dice game


  include win32lib.ew

  without warning

  ------------------------------------------

  -- CONTROLS:


  constant WinDice =3D

  create( Window, "Win Dice!", 0, Default, Default, 400, 200, 0 )


  -- create a control in the window

  constant Throw_Button =3D

  create( PushButton, "&Throw Dice", WinDice, 100, 30, 80, 40, 0 )

  ----------------------------------------------

  -- ACTIONS (things to do when initiating events occur):


  -- action to take when the window opens

  global procedure onPaint_WinDice( integer x1, integer y1, integer x2,
  integer y2 )

  setPosition(WinDice,1,1) -- sets initial position for text

  wPuts( WinDice, "WinDice Version 1.0 Click the Throw dice button to =
play" )

  end procedure

  -- action to take when roll dice button pressed:

  procedure RollDice()

  integer d1,d2,dt

  d1 =3D rand( 6 ) -- get dice values

  d2 =3D rand( 6 )

  dt =3D d1 + d2


  repaintWindow(WinDice) -- clears screen so new numbers don't overwrite =
old

  setPosition(WinDice,1,20) --sets position of first number

  wPrint(WinDice,d1)

  setPosition(WinDice,20,20)-- sets position of second number

  wPrint(WinDice,d2)

  setPosition(WinDice,40,20)-- sets position of second number

  wPrint(WinDice,dt)

  if dt =3D 7 -- or 11
        then
     setPosition(WinDice,1,50)
     wPuts (WinDice, "**WINNER***")
     end if
  end procedure


  -----------------------------------------------

  -- EVENTS (tell Windows when to do an action & what action to do):

  onPaint[WinDice] =3D routine_id( "onPaint_WinDice" )

  onClick[Throw_Button]=3Droutine_id("RollDice")

  -----------------------------------------------

  -- MAIN LOOP:


  -- hand control over to Windows

  WinMain( WinDice, Normal )

  =20

  -- end code
  http://ka9qlq.tripod.com/

------=_NextPart_000_0024_01BFF504.145EE1A0
        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.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#a8c8f0>
<DIV>I think you mean to test for:</DIV>
<DIV>&nbsp;</DIV>
<DIV>If dt =3D 7 or dt =3D 11 then</DIV>
<DIV>&nbsp;&nbsp;&nbsp; -- you win</DIV>
<DIV>&nbsp;</DIV>
<DIV>Right?</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Oorspronkelijk bericht ----- =
</DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>Van:</B>=20
  <A href=3D"mailto:ka9qlq at HOTMAIL.COM" =
title=3Dka9qlq at HOTMAIL.COM>A.R.S. Alvin=20
  Koffman</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Aan:</B> <A=20
  href=3D"mailto:EUPHORIA at LISTSERV.MUOHIO.EDU"=20
  title=3DEUPHORIA at LISTSERV.MUOHIO.EDU>EUPHORIA at LISTSERV.MUOHIO.EDU</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Verzonden:</B> zondag 23 juli 2000=20
23:48</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Onderwerp:</B> Gosh darn dag nab=20
  flabbergastrations!!!!!!!!</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=3DArial size=3D2>Just when I think I might have a =
handle on this=20
  stuff my computer yells STUPID!!!</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>This code works, your&nbsp;a winner =
on 7 only,=20
  but look at the "if then" test. Uncomment the or statement, and your a =
winner=20
  on everything. This makes no sense!!!!! I'm no a smart man, but I =
(thought)=20
  know what an or is for. I know this isn't proper code but I'm just =
trying to=20
  "get" things right now.</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2>Alvin </FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- begin code</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- A simple Windows dice =
game</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>include win32lib.ew</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>without warning</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>------------------------------------------</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- CONTROLS:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>constant WinDice =3D</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>create( Window, "Win Dice!", 0, =
Default, Default,=20
  400, 200, 0 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>-- create a control in the=20
window</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>constant Throw_Button =
=3D</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>create( PushButton, "&amp;Throw =
Dice", WinDice,=20
  100, 30, 80, 40, 0 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>----------------------------------------------</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- ACTIONS (things to do when =
initiating events=20
  occur):</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>-- action to take when the window =

  opens</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>global procedure onPaint_WinDice( =
integer x1,=20
  integer y1, integer x2,<BR>integer y2 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,1,1) -- sets =
initial position=20
  for text</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPuts( WinDice, "WinDice Version 1.0 =
Click the=20
  Throw dice button to play" )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>end procedure</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- action to take when roll dice =
button=20
  pressed:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>procedure RollDice()</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>integer d1,d2,dt</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>d1 =3D rand( 6 ) -- get dice =
values</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>d2 =3D rand( 6 )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>dt =3D d1 + d2</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>repaintWindow(WinDice) -- clears =
screen so=20
  new numbers don't overwrite old</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,1,20) --sets =
position of=20
  first number</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPrint(WinDice,d1)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,20,20)-- sets =
position of=20
  second number</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPrint(WinDice,d2)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>setPosition(WinDice,40,20)-- sets =
position of=20
  second number</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>wPrint(WinDice,dt)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>if dt =3D 7 -- or=20
  11<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<BR>&nbsp;&nbsp;=20
  setPosition(WinDice,1,50)<BR>&nbsp;&nbsp; wPuts (WinDice,=20
  "**WINNER***")<BR>&nbsp;&nbsp; end if<BR>end procedure</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  =

  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- EVENTS (tell Windows when to do an =
action=20
  &amp; what action to do):</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>onPaint[WinDice] =3D routine_id( =
"onPaint_WinDice"=20
  )</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>onClick[Throw_Button]=3Droutine_id("RollDice")</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial=20
  size=3D2>-----------------------------------------------</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- MAIN LOOP:</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><BR>-- hand control over to =
Windows</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>WinMain( WinDice, Normal =
)</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>-- end code</FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><A=20
  =

------=_NextPart_000_0024_01BFF504.145EE1A0--

new topic     » goto parent     » topic index » view message » categorize

4. Re: Gosh darn dag nab flabbergastrations!!!!!!!!

------=_NextPart_000_0031_01BFF4ED.0A654A20
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Yes!! Thank both of you. I knew it had to be something simple.
Alvin=20
http://ka9qlq.tripod.com/

------=_NextPart_000_0031_01BFF4ED.0A654A20
        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>Yes!! Thank both of you. I knew it had =
to be=20
something simple.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Alvin </FONT></DIV>
<DIV><A=20
ODY></HTML>

------=_NextPart_000_0031_01BFF4ED.0A654A20--

new topic     » goto parent     » topic index » view message » categorize

5. Re: Gosh darn dag nab flabbergastrations!!!!!!!!

On Sun, 23 Jul 2000 16:48:56 -0500, A.R.S. Alvin Koffman
<ka9qlq at HOTMAIL.COM> wrote:

>Just when I think I might have a handle on this stuff my computer yells
STUPID!!!
>This code works, your a winner on 7 only, but look at the "if then" test.
Uncomment the or statement, and your a winner on everything. This makes no
sense!!!!! I'm no a smart man, but I (thought) know what an or is for. I
know this isn't proper code but I'm just trying to "get" things right now.
>Alvin

The problem here is really simple. Notice that you don't test the dice
variables...you're really testing if 7 or 11 are not equal to zero. You
might want to change "7" to "dt=7" and "11" to "dt=11"

new topic     » goto parent     » topic index » view message » categorize

6. Re: Gosh darn dag nab flabbergastrations!!!!!!!!

Yah I'm beginning to wonder if I have the temperament to program. I over
look to many "dah" things.
Alvin
http://ka9qlq.tripod.com/
----- Original Message -----
From: Darth Maul, aka Matt <Uglyfish87 at HOTMAIL.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Tuesday, July 25, 2000 4:06 PM
Subject: Re: Gosh darn dag nab flabbergastrations!!!!!!!!


> On Sun, 23 Jul 2000 16:48:56 -0500, A.R.S. Alvin Koffman
> <ka9qlq at HOTMAIL.COM> wrote:
>
> >Just when I think I might have a handle on this stuff my computer yells
> STUPID!!!
> >This code works, your a winner on 7 only, but look at the "if then" test.
> Uncomment the or statement, and your a winner on everything. This makes no
> sense!!!!! I'm no a smart man, but I (thought) know what an or is for. I
> know this isn't proper code but I'm just trying to "get" things right now.
> >Alvin
>
> The problem here is really simple. Notice that you don't test the dice
> variables...you're really testing if 7 or 11 are not equal to zero. You
> might want to change "7" to "dt=7" and "11" to "dt=11"
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu