CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 6 1234 ... LastLast
Results 1 to 15 of 80
  1. #1
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Programming Problem.

    I have written a game playing program. Unfortuately, it is not working the way I want. Please help, Here is the relevant code.

    Code:
        Play = true;
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  2. #2
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Programming Problem.

    Try
    Code:
    Play = false;
    Regards,
    Ramkrishna Pawar

  3. #3
    Join Date
    Jan 2003
    Location
    Cambridge, UK
    Posts
    752

    Re: Programming Problem.

    or even

    Code:
    Play = static_cast<bool>(NULL);
    Cheers,

    Alex
    Please rate this post if you find it helpful

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Programming Problem.

    What is Play? What is the way you want and what is actually happening? Did you try to debug it?
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Programming Problem.

    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
    Code:
    On Error Goto Game_Over
    Play = True
    :Game_over
    Play = False
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  6. #6
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230

    Re: Programming Problem.

    Gremlin you forgot

    Code:
    On Error Goto Game_Over
        While 1
            Play = True
        Wend
    :Game_over
        Play = False
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

  7. #7
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Programming Problem.

    Thanks for all of the valuable suggestions. I think I will try

    Code:
      B= true;
      Play =( B & B)  | !( B& B);


    <ROFL>
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  8. #8
    Join Date
    Nov 2001
    Location
    Beyond Juslibol
    Posts
    1,688

    Re: Programming Problem.

    Quote Originally Posted by TheCPUWizard
    I have written a game playing program. Unfortuately, it is not working the way I want. Please help, Here is the relevant code.

    Code:
        Play = true;
    Have you looked at MSDN? Try also searching the forums and the FAQs


  9. #9
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230

    Re: Programming Problem.

    Quote Originally Posted by TheCPUWizard
    I have written a game playing program. Unfortuately, it is not working the way I want. Please help, Here is the relevant code.

    Code:
        Play = true;

    This sounds like you are another one trying to ask us to solve your homework...
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

  10. #10

    Re: Programming Problem.

    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.

  11. #11
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: Programming Problem.

    All the best games are written in perl. You should probably switch to it too and not waste your time with C.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  12. #12
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Programming Problem.

    I was considering writing it in APL, but it all looks like greek to me then.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  13. #13
    Join Date
    Feb 2005
    Location
    Normandy in France
    Posts
    4,590

    Re: Programming Problem.

    Use:
    Code:
    Play++;
    It's faster (because it's obfuscated).
    Or, even better:
    Code:
    ++Play; /* even faster */
    Note: Removing the comment will give faster code! |33(0z shorter (0D3 1|\|(R3S3 SP33|)
    "inherit to be reused by code that uses the base class, not to reuse base class code", Sutter and Alexandrescu, C++ Coding Standards.
    Club of lovers of the C++ typecasts cute syntax: Only recorded member.

    Out of memory happens! Handle it properly!
    Say no to g_new()!

  14. #14
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Programming Problem.

    Note: Removing the comment will give faster code!
    Will shorting all variables to single letters, and removing all whitespace/linebreaks also make it faster????
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  15. #15
    Join Date
    Dec 2004
    Location
    Poland
    Posts
    1,165

    Re: Programming Problem.

    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
    B+!
    'There is no cat' - A. Einstein

    Use &#91;code] [/code] tags!

    Did YOU share your photo with us at CG Members photo gallery ?

Page 1 of 6 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured