+ Reply to Thread
Page 4 of 4 FirstFirst ... 234
Results 31 to 36 of 36

Thread: JavaScript:Tutorial, Your First Game!

  1. #31
    DevilsCharm's Avatar
    DevilsCharm is offline Programming God
    Join Date
    Jul 2006
    Posts
    884
    Rep Power
    0

    Re: JavaScript:Tutorial, Your First Game!

    I made something like this a long time ago in C++, although there were a few bugs in it.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #32
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: JavaScript:Tutorial, Your First Game!

    Really? It's quite a basic game.... How come you had a few bugs?

  4. #33
    cryptokyle's Avatar
    cryptokyle is offline Newbie
    Join Date
    May 2009
    Location
    Singapore
    Posts
    11
    Rep Power
    0

    Re: JavaScript:Tutorial, Your First Game!

    just a question: is there not a need to include else if before the subsequent comparing lines?

  5. #34
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: JavaScript:Tutorial, Your First Game!

    You could use else if. It probably would be better to use else if because as it currently is, if your guess is lower, the program is still going to assess if you have guessed higher (which you know you haven't). Thus your program would take slightly more time than it should.

  6. #35
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: JavaScript:Tutorial, Your First Game!

    Yes, the else if should save a few cpu cycles. Will not be noticeable but the difference is there.

  7. #36
    Join Date
    Mar 2008
    Posts
    7,145
    Rep Power
    86

    Re: JavaScript:Tutorial, Your First Game!

    It doesn't really matter too much in a small program like this but in bigger programs it could make a huge difference.

+ Reply to Thread
Page 4 of 4 FirstFirst ... 234

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JavaScript:Tutorial, Confirmation Box
    By TcM in forum JavaScript Tutorials
    Replies: 5
    Last Post: 11-07-2009, 08:13 PM
  2. JavaScript:Tutorial, Prompt
    By TcM in forum JavaScript Tutorials
    Replies: 2
    Last Post: 01-21-2007, 01:58 AM
  3. JavaScript:Tutorial, Loops
    By TcM in forum JavaScript Tutorials
    Replies: 4
    Last Post: 12-13-2006, 06:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

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