You are here: DEVPPL Forum Programming Visual Basic Forum
NOTIFICATIONS
54.059
MEMBERS
15.676
TOPICS
62.240
POSTS
  562
FLASH GAMES
7.740
TUTORIALS
 

Login

E-mail:
Password:

snakes and ladders II

0

Loading

snakes and ladders II

Postby Charndex » Thu May 05, 2005 2:03 pm

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.
Charndex
 
Reputation: 0
Posts: 3
Joined: Fri Apr 29, 2005 11:14 am
Location: leeds
Highscores: 0
Arcade winning challenges: 0

snakes and ladders II - Sponsored results

Sponsored results

Login to get rid of ads

 

0

Loading

Postby Dafunkymunky » Fri May 06, 2005 6:52 am

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....
Dafunkymunky
 
Reputation: 0
Posts: 183
Joined: Fri Apr 08, 2005 8:32 am
Location: India
Highscores: 0
Arcade winning challenges: 0
^ Back to Top