|
It is currently Thu Jan 08, 2009 8:41 pm
|
View unanswered posts | View active topics
|
Page 1 of 1
|
[ 2 posts ] |
|
| Author |
Message |
|
charndex
|
Post subject: snakes and ladders II Posted: Thu May 05, 2005 2:03 pm |
|
Joined: Fri Apr 29, 2005 11:14 am Posts: 3 Location: leeds
|
|
thanx to "dafunkymunky" for replyin my first post. the question asks me to modify my solution so that it takes input of the number of games the player wants to play, then play those games and show the average number of throws per game. so what functions or statements do i use to get this sorted.
hope that explains my question clear enough.
|
|
| Top |
|
 |
|
dafunkymunky
|
Post subject: Posted: Fri May 06, 2005 6:52 am |
|
 |
| 100+ Club |
 |
Joined: Fri Apr 08, 2005 8:32 am Posts: 179 Location: India
|
|
your welcome charndex the forum exists to help others
i think you wanna do something like this
ask the user how many games he wants to play
say he inputs 5
now if the no of times the dice rolls in the 1,2,3,4,5 games respectively are 10 12 23 6 and 20 then you wanna display the the avarage no of dice throws per game i.e. (10+12+23+6+20)/5
if this is what you wanna do i have a question does the user play the game continuously or does he have an option to continue his previous game the next time he enters
the first one is simple
make two froms in the first form you store the details of no of games played and also get the input from the user about the same..
in the second you have your normal game that you might have already created
first you asign an array to store the no of dice throws to played
like Dim dicecount(1 To 10) As Integer
here in the first element we store the dice throw and so on now get the input from the user for the no of games to be played and this input may be greater then the size of the array we have assigned i.e 10 so if the user inputs 12 as the no of games to be played we cant store the last two values so we have resize the array likew this
ReDim dicecount(1 To userenteredvalue)
or
ReDim Preserve dicecount(1 To userenteredvalue)
the difference b/w the two is that in the second command the values previously stored in the array will be retained but in the othereverythig will be lost
now to start the game load the form2(game) using form1 and everytime the user exits the game page(i.e wins or wants to skip the current game) we we store the no of dice counts which you have counted in the game form to the dice counts array
form to form linking of variables is done like this
form1.dicecounts(UBound(dicecounts)+1)=diccounts
the ubound command get you the no of variables already store in the array
now check if the
ubound(dicecounts)==noofgameplay
noofgameplay is the variable in which you have stored howmany games to play
if true using a for loop do the necesary calculation
and display
man i think this is too much well i might have gone wrong wioth the form to from variable linking syantax but i will give youthe right one tomorrow
and also please tick the solved tag if you have found the solution to your post..
_________________ --------DAFUNKYMUNKY--------
::THE::NECESSARY::[D]EVIL::
....errr i mean munky....
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums. Click here to Register
If you are a current member here on DEVPPL, please login below:
|
|
|