3 Replies - 2170 Views - Last Post: 14 November 2006 - 08:47 AM

#1 The Javanator  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-November 06

javascript & ASP.NET Guessing game

Posted 13 November 2006 - 05:45 AM

i have a homework project that i can't crack!!!! I was asked to create a ASP.NET that allows users to play a guessing game.I have to use javascript math object to create a random number between 1-100.I have to have guessed to high to low in the code and it wants me to use the session object to record the number of tries.Could someone help me Please its due in 24 hours!!!!!!
Is This A Good Question/Topic? 0
  • +

Replies To: javascript & ASP.NET Guessing game

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: javascript & ASP.NET Guessing game

Posted 13 November 2006 - 07:02 AM

Hello,

The site has a policy by which we prefer to see a good faith effort on the part of the user before providing source code in the matter of academic assignments. If you could please post the code you've written in an effort to resolve the assignment, our members would be pleased to provide some guidance.

Welcome to dream in code!
Was This Post Helpful? 0
  • +
  • -

#3 Chubber  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 131
  • Joined: 16-October 06

Re: javascript & ASP.NET Guessing game

Posted 13 November 2006 - 07:05 AM

View PostThe Javanator, on 13 Nov, 2006 - 05:45 AM, said:

i have a homework project that i can't crack!!!! I was asked to create a ASP.NET that allows users to play a guessing game.I have to use javascript math object to create a random number between 1-100.I have to have guessed to high to low in the code and it wants me to use the session object to record the number of tries.Could someone help me Please its due in 24 hours!!!!!!



For the high-low part of the guessing game, there are about 100 samples already on the web. You can find them easily enough.

I don't know why you would want to persist the number of guesses to the Session object, you could do all of that in javascript, but who knows how professors minds work? To do that you will need a server side event on the "submit guess" button that will increment the session variable. In that case you might as well do all of the calculations and programming server side. Just use the Javascript math object to get a random number on page load and set the value of a hidden field for the initial guess. Then you can ignore that value after the first guess, cause it will keep getting set.
Was This Post Helpful? 0
  • +
  • -

#4 The Javanator  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-November 06

Re: javascript & ASP.NET Guessing game

Posted 14 November 2006 - 08:47 AM

View PostChubber, on 13 Nov, 2006 - 07:05 AM, said:

View PostThe Javanator, on 13 Nov, 2006 - 05:45 AM, said:

i have a homework project that i can't crack!!!! I was asked to create a ASP.NET that allows users to play a guessing game.I have to use javascript math object to create a random number between 1-100.I have to have guessed to high to low in the code and it wants me to use the session object to record the number of tries.Could someone help me Please its due in 24 hours!!!!!!



For the high-low part of the guessing game, there are about 100 samples already on the web. You can find them easily enough.

I don't know why you would want to persist the number of guesses to the Session object, you could do all of that in javascript, but who knows how professors minds work? To do that you will need a server side event on the "submit guess" button that will increment the session variable. In that case you might as well do all of the calculations and programming server side. Just use the Javascript math object to get a random number on page load and set the value of a hidden field for the initial guess. Then you can ignore that value after the first guess, cause it will keep getting set.

thanks everyone i got it figured out!!!!!!!!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1