I have written a game playing program. Unfortuately, it is not working the way I want. Please help, Here is the relevant code.
:eek: :D :D :DCode:Play = true;
Printable View
I have written a game playing program. Unfortuately, it is not working the way I want. Please help, Here is the relevant code.
:eek: :D :D :DCode:Play = true;
Try
Code:Play = false;
or even
:DCode:Play = static_cast<bool>(NULL);
What is Play? What is the way you want and what is actually happening? Did you try to debug it?
Please expand on your original Post...
Is Play a UDT, Boolen type, or integer value ????
Have you tried your code in a Module or maybe a Dll Class ..
Maybe you must include some error traps...
Might i sujest:D :D :D :D :DCode:On Error Goto Game_Over
Play = True
:Game_over
Play = False
Gremlin you forgot
Code:On Error Goto Game_Over
While 1
Play = True
Wend
:Game_over
Play = False
Thanks for all of the valuable suggestions. I think I will try
:rolleyes:Code:B= true;
Play =( B & B) | !( B& B);
<ROFL> :D
Have you looked at MSDN? Try also searching the forums and the FAQsQuote:
Originally Posted by TheCPUWizard
;)
Quote:
Originally Posted by TheCPUWizard
This sounds like you are another one trying to ask us to solve your homework...
Why are you trying to make a game playing program? I refuse to give any answers or tips until I know why you are doing this in the first place, and after a few messages back and forth which will bump up my posting numbers, then I'll provide information pretty much identical to the two or three prior to my post.
Sad... but true.
All the best games are written in perl. You should probably switch to it too and not waste your time with C.
I was considering writing it in APL, but it all looks like greek to me then. ;)
Use:
It's faster (because it's obfuscated).Code:Play++;
Or, even better:
Note: Removing the comment will give faster code! |33(0z shorter (0D3 1|\|(R3S3 SP33|)Code:++Play; /* even faster */
Will shorting all variables to single letters, and removing all whitespace/linebreaks also make it faster???? :lol:Quote:
Note: Removing the comment will give faster code!
YOUr program is OK Because you set Play To TRUE .True means it play ,So Your Code is Ok .Problem Is Not with This COde .Show us more Code . Too Try Play = 1 or Declare Variable Int i = 0 and do Play = i | !i.
And Next Time post in Right Forum (C++ or VB), General Discussion/Chot-Chat is for Chit-Chat ,and Not Programming
Tanx
Play starts with an upper case character and therefore it MUST be a function or a type. You cannot assign true to a function or a type, because ... they exist by default and therefore can never be false. Try converting a function or a type to boolean, the compiler won't let you - that's because they are true by default. :DQuote:
Originally Posted by TheCPUWizard
BTW- please don't use code tags in your posts, they slow down my web-browser
Code:
Play = true;
UMMM, this looks like it should work. And work well!
Can you zip the project for us to look at?
I've got it:
Code:
Code:
Code:
Play = TRUE; // 32bit bool
Your code is quite suspicious. What are you trying to do here?:rolleyes:Quote:
Originally Posted by TheCPUWizard
Yeah. Please understand that we couldn't provide much help as you have, so far, provided very little details. I don't think we can help you in your debugging as you haven't give us a fully compilable and running code to demonstrate that it doesn't work. In addition, you also haven't describe what is your expected program behavior and how it fails - any error, exception, etc.
In the future, please read the AUP and following its guideline to obtain better assistance. :rolleyes: :D :D :D
The real problem as I see it is that you are so old you don't know what play is and thus unable to really understand the code or it's purpose.Quote:
Originally Posted by TheCPUWizard
I did an extensive search in the net and found a very good example of this type of code.
Here is the thread ..
..
..
Payback is a ...itch... ;)Quote:
he real problem as I see it is that you are so old you don't know what play is and thus unable to really understand the code or it's purpose.
:eek: I see you got your revenge on the other forum. :DQuote:
Originally Posted by TheCPUWizard
I can take it and give it out...must be something in the water on the east coast...as I'm originally from a place just west of you...and no, Ben Franklin was not my neighbor... :D :D :DQuote:
Originally Posted by TheCPUWizard
Try setting Play to True, then False, then True, then False, then True, then False again maybe that'll fix your problem :lol: :D
I think the problem might be elsewhere: If play is for a piano, you must initialize the instrumentation library first with ILStartup().
Hi TheCPOWizord,
I having same problem, do you solve it, plz help, bye. :(
I cant understand why you are trying to do something in the wrong foot.
instead of
all you should be doing isCode:play = true;
and Ejaz, i see you have only 0000.3558 posts, :eek: welcome to the CG forums. you are a new member here.Code:printf("Please shut down your computer, go play some football.\n ");
Before you get some responses, there are some formalities you should do :)
- Who referred you to CG ?
- Where did you hear about CG ?
- New York times ?- Wall street journal ?- Times Square Garden, Pop corn seller ?- The Ice Cream Man ?- Super man ?- Due to liscencing and copyright issues, your age should be above or less than 12 years ? Do u agree ? :D
- What would you do if you find a stranger wandering in CG premisis,
- Would you notify the site Admin ?- Greet him and continue on your path ?:D :p
Brilliant!!! :D :D :DQuote:
Originally Posted by Hobson
Hi sreehari,Quote:
Originally Posted by sreehari
sorry my englsh not good, I am new, my friend tell me about this place and my license is stolen too, my teacher given my asignment, its urgent, plz help. :o
Talk to Boris the bullet dodger in London, tell him 'you ate his dimond' and he will be very eager to help you. :DQuote:
Originally Posted by Ejaz
Actually, I think it's german for 3.558 posts. :wave:Quote:
Originally Posted by sreehari
---
I have a similar problem to the thread starter, any ideas? My code is here:
http://www.rclsoftware.org.uk/cpp/squares.gif
Yes, surely.Quote:
Originally Posted by TheCPUWizard
And, if it doesn't work, we can do sanity checks:
Then:Code:bool IsTrue(bool x) {
return (true==true && false==false && x==true && x!=false)==true;
}
Code:Play=true;
if (IsTrue(Play)==true) /* ok */;
else {
MessageBox(NULL,"Error dude. Press ok to quit","Error dude!",0);
*((int*)0)=42; /* cleanly exits */
}
That's implementation dependent (i.e. it will only work if pointers have been implemented at all).Quote:
Originally Posted by SuperKoko
:lol: :DQuote:
Originally Posted by GremlinSA
Oooopppss
I forgot you must also set the game parametersWell .. you get the idea.. :DCode:Set Play = New Game
Play.Lives = Unlimited
Play.Level = 1
Play.Score = 0
'...etc
:D :D :D OMG, You are so good at it... :D :D :DQuote:
Originally Posted by Hobson
Btw, you missed h in "Thanx".. that is the way it is! ;)
But I will ignore that because you've done it really brilliantly as Krishnaa said. :D :D :D
Thanks - informal word for "Thank you", also often mispelled as "Thanx", "Tanks", "10x", and many other ways.Quote:
Originally Posted by exterminator
So Yes EXTERMINATOR, It May be THANKS, but defianiation says That Tanks is also OK. So I Am Not wrong.
Tanks :p
You did not bold some parts.. to make it more expressive.. :DQuote:
Originally Posted by Hobson
Lettus Stay On Topic !!!
Will that work????Code:TopicHandler() { ProvideHelp(); }
void MainFunction(object o)
{
if (TypeOf(o) == Topical)
TopicHandler()
}
It might. Has RTTI been enabled for this thread? :D
No, implicit int has been banned from C++.Quote:
Originally Posted by TheCPUWizard
SuperKoko, do you write C++ compilers for a living ?
:thumb:
Who said it is C++? ;) The OP never specified that! :D
Wait !!!!! was this a C++ Code snip....
I'm sorry but you posted it in the wrong forum... I've been giving VB6 solutions to the problem, No wonder my solutions didn't work..
Ask the moderator to move this thread to the correct forum.... :D:D:D
http://i141.photobucket.com/albums/r...e-needpics.gif
The [:p] adds last bit of perfection to it. :thumb:Quote:
Originally Posted by Hobson
you should do like this:
play != false;
if (false)
goto sleep;
This should work
play = bool.Parse(new String(new char[] { 'T', 'r', 'u', 'e' }));