RE: If else

  • From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 10 Feb 2011 09:53:39 -0500

Oh I had one more thing to say tylor.  Parsing is not a bottle neck if you
know AI.  There are lots of algorithms you have not even studied yet one of
them being the tri-tree if you think it will be a bottle neck your wrong.

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
Tyler
Sent: Thursday, February 10, 2011 9:11 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: If else

Parsing some of that isn't to bad, and you really don't want to if 
you're running a mud. The command parser is going to become a huge 
bottleneck. You could just:
get apples from bag
get apples from 2.bag

etc.
One thing I want to do is something like: get 5 apples from basket in bag
Or allow for nested containers.
On 2/10/2011 5:22 AM, Ken Perry wrote:
>
> I want to point out that all these ideas for an adventure game is great
till
> you actually try to code one this way.  You really need a tri-tree at
least
> to parse the commands and maybe even some natural language algorithms or
the
> game is very hard to use and very robotic.  For example you need to let
> people get stuff from a bag let's see a simple command parser which most
> muds use go word at a time so the only thing you can use is
>
> Get item name from bag
>
>
> Well what if you want to get 4 of them from the bag then you have to add
> complexity to your if statements god forbid your using just if statements
>
> Get 4 apples from bag
>
> Note that is if someone was smart enough to put an s on apple they are not
> always. So your parser should be able to take
>
> Get 4 apples from bag
> Or
> Get 4 apple from bag
>
>
> Of course that brings up another problem maybe someone wants to type real
> English
>
> Get apples from bag
>
> That should get all your apples not just one
>
> Get all apples
>
> Should do the same.
>
> Wait what if someone wants to  do something like this
>
> Get all the apples out of my bag.
>
> Wow you just jumped the complexity or what about
>
> Get all apples from bill's bag
>
> Do you allow it do you understand it?
>
> What if you get it from your third bag cause we all know we carry more
than
> one bag
>
> Get apples from 3 bag?
>
>
> Boy that sounds stupid so maybe we should allow
>
> Get apples from third bag
>
> Hmm Try to figure it out if you're up to 55 though does the person have to
> type
>
> Get apples from the fifty fifth bag?
>
>
>
> In just these examples you can see adventure games are not as easy to
write
> if you don't want to make the person learn a language to do it.
>
> Now what some people do is make a graphical interface but even that has so
> many problems with just simple if statements that I can't even go there.
I
> think the last I checked my mud has over 616 commands and 224 spells all
of
> which have different parsing schemes.  I am not saying my mud is perfect
> either I need to add some language naturalization and maybe when I am done
> with my current job it will get a huge intelligence overall but the point
is
> if statements is not always your best method to figure about a command.
If
> you haven't read on tri-trees you might want to.
>
> ken
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of John G
> Sent: Thursday, February 10, 2011 2:12 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: If else
>
>
>> Another way to do it is this:
>>
>> string direction;
>> cout<<  "Which way to go?  ";
>> cin>>  direction;
>> if !(direction == "north" || direction == "south" || direction ==
>> "east" || direction == "west")
>> {
>> cout<<  "You go "<<  direction<<  "."<<  endl;
>> }
>> else {
>> cout<<  "You can't go that way.";
>> }
>>
>>
>> This way, you use a variable for your direction and introduce an error
>> message if the user doesn't go the right way.
>>
>> is the logical negation symbol (!) just after the "if" intentional??
>
>
>
>> Alex M
>>
>> On 2/9/11, John G<jglists0@xxxxxxxxx>  wrote:
>>> I think I meant to say Kristoffer in my previous message. At any
>>> rate, you're all welcome to contact me directly if you need that
>>> extra help with c/c++.
>>> kind regards
>>> John
>>>
>>> At 22:34 09/02/2011, you wrote:
>>>> Hmm, strange. that was what I tried.
>>>> I'll have another look tomorrow at this.
>>>> /Kristoffer
>>>> /Kristoffer
>>>>
>>>> ----- Original Message -----
>>>> From:<mailto:tyler@xxxxxxxxxxxxx>Littlefield, Tyler
>>>> To:
> <mailto:programmingblind@xxxxxxxxxxxxx>programmingblind@xxxxxxxxxxxxx
>>>> Sent: Wednesday, February 09, 2011 11:26 PM
>>>> Subject: Re: If else
>>>>
>>>> if (direction == "north")
>>>> {
>>>> std::cout<<  "You go north."<<  std::endl;
>>>> }
>>>> else if (direction =="south")
>>>> {
>>>> std::cout<<  "You go south."<<  std::endl;
>>>> }
>>>>
>>>> On 2/9/2011 3:07 PM, Kristoffer Gustafsson wrote:
>>>>> Hi.
>>>>> Now I've decided that I'll learn to do things both without goto,
>>>>> and with it. Because then I'll maybe discover that goto is bad:)
>>>>> I got one last code question today.
>>>>> I need so that my program can do more than one action. for example
>>>>> of writing a text adventure you want many.
>>>>> I've managed to put an if statement in my code. for example
>>>>> if direction=="south";
>>>>> {
>>>>> cout<<"you go south.";
>>>>> }
>>>>> Now if I want to go north, how can I do that?
>>>>> I tried if else, but it only says "expected primary expression
>>>>> before else expected.
>>>>> Can you help me with this please?
>>>>> /Kristoffer
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Ty
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>


-- 

Thanks,
Ty

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: