Board index » delphi » A Real Hard 'Case' !

A Real Hard 'Case' !

Quote
In article <01bd689d$b7e16c80$LocalHost@default>, ajc <a...@{*word*269}.net> wrote:

:Can any Pascal guru pls explain what I am doing wrong in the attached
:program - {*word*99}s01.pas

Sorry, no, since you attached a binary which will removed by the
bincancel bots. Please see

 13686 Apr 6 1997 ftp://garbo.uwasa.fi/pc/doc-net/binfaq.zip
 binfaq.zip The Bincancel FAQ by Shaun Davis-Gluyas

 http://www.cen.uiuc.edu/~tskirvin/faqs/cancel.html
 Cancel Messages: Frequently Asked Questions by Tim Skirvin

   All the best, Timo

....................................................................
Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland

Spam foiling in effect.  My email filter autoresponder will return a
required email password to users not yet in the privileges database.

 

Re:A Real Hard 'Case' !


Quote
ajc wrote:

> Can any Pascal guru pls explain what I am doing wrong in the attached
> program - {*word*99}s01.pas

> The problem appears on the last Case Statement about 8 lines
> from the end - I keep getting 'Cannot evaluate Expression'

> But I cannot see what I am doing wrong.

> This is an assignment to design a *simple* text based {*word*99}s dice game :)

> If anyone can help or if anyone has written a similar piece of code
> I would be very grateful to hear from you

> TIA
> andy
> a...@{*word*269}.net

>                    Name: {*word*99}s01.pas
>     Part 1.2       Type: unspecified type (application/octet-stream)
>                Encoding: x-uuencode

First - questions are a lot easier to answer if you only include the
code you are having trouble with and include it in you post - not as an
attachment.

- Show quoted text -

Quote
>   Case Dice_Total_Value of

>            7,11 : Win;
>            2,3,12 : Lose;
>            4,5,6,8,9,10 : Play_Again;

>     Else

>         If Gameflag >1 {ie DICE THROWN AGAIN} Then

>        Case Dice_total_Value of

>            7 : Lose;
>            PlayersPoint : If Dice_total_Value = Playerspoint Then Win;
>            Dice_Total_Value <> 7 OR Playerspoint : Play_Again;
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>       End;

You are trying to evaluate a Boolean expression ( if A<>B or C). This is
something that the CASE statement can not handle. Maybe this will work-

                       7 : Lose;
            PlayersPoint : If Dice_total_Value = Playerspoint
                             Then Win
                             else if (Dice_Total_Value <> 7) OR                                Playerspoint
then Play_Again;

--
Val Mehling - anti-spam in effect.
For e-mail reply to:
  va...@earthlink.net

Other Threads