Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Bowling Score Algorithm


Hey everyone...

I am attempting to write a program that calculates the score of a bowling game. I have the pinfall's stored in a 2-d array

pinfall(n,m)
-where n is the framenumber 1-10 and m is the shot number 1,2

I am having trouble writing the code to calculate the score. If there are any suggestions, please post 'em

-Mike




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Have You Ever Seen Bowling Score Calculator That Wrote It By Visual Basic?
I would like to have code for bowling score calculator. I have seen once but it's wrote in Java and it's shown in http://public.csusm.edu/public_html/veres/
I want to write the same as that but using Visual basic program.
Thank you very much for your time.

Bowling
im making a bowling game its pretty cool. i need to score it though. the code is attached below. can anyone write a bowling scorer sub or function. i cant figure it out. there are some java ones but i dont know java. if anyone can at rubygarden.com there is a java one.

thanks
TCGoober

Bowling OCX
I am looking for a VB OCX that shows the ten frames for bowling, add scores, spares and strikes. I saw it once in a shareware site and cannot find it again.
Does anyone know where I can find this component? Thanks.

Need Help With Coding Bowling Game W/Arrays And IF's
Please help. I've been trying to figure out how to get this "bowling game" project to run and I'm lost.
I've attached what I've done and hopefully you can see where I need help.

Series should = all 3 game score entries and the average is the series/3.

Thanks,
Kimbuka

High Score, Or Should I Say, Low Score
how do I make a high score thing for the guessing game I have that only shows the top 5 low number of times they guess to get the number?? thank you.

Requesting Help With Simple Bowling Scorekeeper Program
Hello vbFolks. I'm quite new at designing programs with visual basic so I'd like to enlist for some advice.

First of all, I'm a computer science student that ventured down the C++ path for a little too long and I re-specced to a VB-oriented track. Since then I've had 1 very basic class in VB programming. I've been working on a little side program for keeping bowling scores but I'm at an impasse and would like some help.

Am I able to do this by using a simple set of control arrays (say 2 text boxes and 1 label per "frame") and using them inside some kind of repetition statement?


on the form i have control arrays txtFirst(10) and txtSecond(10) for balls thrown
and lblScore(10) for the score on each frame. The user types the score for each
ball and I want it to update the Score label automatically.

I cannot figure out how to store the typed numbers to the txtFirst(i).text property at runtime. What's more is that I've had equally frustrating moments trying to do something as simple as Code: lblScore(i).Caption = Val(txtFirst(i).text) + Val(txtSecond(i).text) for the first frame on the sheet, then trying to carry forward that value for future use.

I'd appreciate some insight on the basics. TIA for the help.

Patrick




Edited by - okipatrick on 6/9/2003 9:15:41 PM

Converting High Score Table To A Low Score Table
Hi,

I have a sub which checks for the highest score and moves the name and score up or down depending on the position for example,

1. test 100
2. test1 99
3 test2 79
4.test3 10

Please can somebody help me convert it to do the opposite or suggest some new code. So the opposite would be,

1. test3 10
2. test2 79
3. test1 99
4. test 100

Many thanks in advance, the orignal code is posted below


Code:
Private Sub MoveDown()
Dim PlayerScore As String, PlayerName As String, x As Integer

PlayerScore = Int(txtaddscore.Text)
PlayerName = txtaddname.Text

If PlayerScore > intscore(9) Then 'If score is higher than lowest (Number 9) score
MsgBox "Congratulations you got a high score", vbInformation, "Top Ten"
For x = 0 To 9
If Int(PlayerScore) > intscore(x) Then
intnewpos = x 'Find highcores position
Exit For
End If
Next x
For x = 9 To intnewpos + 1 Step -1
strnames(x) = strnames(x - 1) 'move names down
intscore(x) = intscore(x - 1) 'move scores down
Next x
strnames(intnewpos) = PlayerName 'Give current name its position
intscore(intnewpos) = PlayerScore 'Give current score its position

Converting High Score Table To A Low Score Table
Hi,

I have a sub which checks for the highest score and moves the name and score up or down depending on the position for example,

1. test 100
2. test1 99
3 test2 79
4.test3 10

Please can somebody help me convert it to do the opposite or suggest some new code. So the opposite would be,

1. test3 10
2. test2 79
3. test1 99
4. test 100

Many thanks in advance, the orignal code is posted below


Code:
Private Sub MoveDown()
Dim PlayerScore As String, PlayerName As String, x As Integer

PlayerScore = Int(txtaddscore.Text)
PlayerName = txtaddname.Text

If PlayerScore > intscore(9) Then 'If score is higher than lowest (Number 9) score
MsgBox "Congratulations you got a high score", vbInformation, "Top Ten"
For x = 0 To 9
If Int(PlayerScore) > intscore(x) Then
intnewpos = x 'Find highcores position
Exit For
End If
Next x
For x = 9 To intnewpos + 1 Step -1
strnames(x) = strnames(x - 1) 'move names down
intscore(x) = intscore(x - 1) 'move scores down
Next x
strnames(intnewpos) = PlayerName 'Give current name its position
intscore(intnewpos) = PlayerScore 'Give current score its position

Score
I've developed a little game and now I want to store the score in a plain text file.

The idea is to store the highest 10 scores along with the player names.
Problem though is that I don't know how to store these scores at the right spot. For example if I scored a fourth place, how can I place my score and name at the fourth line in the text file ?

Can someone help me out ?

Anyone Know Where To Score.....
...Anyone know where to score up on some icons/graphics to use in programs--aside from the usual graphics included in VB?

thanks

Top 10 Score
Hello again friends.
Ive been trying to make a high score list (form?) to attach my game.
But i dont think i can do it foreever. I sent you gurus all my project
in zip attachment. You will understand what im trying as soon as you open
the attachment.
Thanks.
bambii.

Keeping The Score
hey guys,

i am making a breakout game on VB5
i solved my previous problem on designing a rectangle as well as making the rectangle dissapear once the ball hits the rectangle. The problem i am having now is that everytimg the ball hits the rectangle i want it to add a score. so for example when i start the game the score is 0.

once the ball hits the rectangle the score is +1 and so on for the rest of the rectangle.

what i have done is drawn each rectangle (59 of them to be exact) and for each rectangle i have named it brick so brick 1 - 59.

this is the code i have for collision:

If ball.IntersectsWith(brick1) Then
brick1 = New Rectangle(10, 35, 0, 0)
End If

so.... how do i tell it (VB) that i want to +1 everytime the ball contacts with a brick. I dont know if i should create a label to show the score, a textbox or ???. Pls Help

thankyou!

Add To Winner Score
Im still working on a tic tac toe game but now iam using a control array to make it easier i have :X lables and O Lables with the indexes of 0-8 from left to right and command butons for each seperate lable with the same index's( like cmdX(0) cmdO(0) dof the first box) what i need to know is how do i have the game add to a winners score and then reset the form to play a new game without loseing the old score(s)?
Heeelp

cmdX(0) cmdO(0) cmdX(1) cmdO(1) cmdX(2) cmdO(2)
lblO(0) lblO(1) lblO(2)
lblX(0) lblX(1) lblX(2)

cmdX(3) cmdO(3) cmdX(4) cmdO(4) cmdX(5) cmdO(5)
lblO(3) lblO(4) lblO(5)
lblX(3) lblX(4) lblX(5)

cmdX(6) cmdO(6) cmdX(7) cmdO(7) cmdX(8) cmdO(8)
lblO(6) lblO(7) lblO(8)
lblX(6) lblX(7) lblX(8)

That is just a general picture of how it looks and the lables are actually on top of eachother both with the visible prop set as false and when a command button is pressed the(like if cmdX(1) were pressed cmdO(1)'s enabled prop would be set to false ) plz help

HELP ME!!!!! Hi Score Table
Quote:
--------------------------------------------------------------------------------
I have a text file with the following information (Hi Score List)

John, 67
Roger, 27
Henry, 28
will, 29
Matt, 17

I want to make Label1.caption = Matt's Score (i.e. 17).
Label2.caption = Roger's Score (i.e. 27)
How do I open the file and read each person's score (Not their name AND score).
--------------------------------------------------------------------------------



I am still having trouble with my program.

The Hi Score list could have any name or score in it.
I want the program to open the txt file as follows.

Open "c:filename" For Input As # 1
Dim JohnScore As string
Line Input # 1, JohnScore 'I want the program to find John's SCORE in the file (i.e. 67) and display it on lablel1.
label1.caption = Val(JohnScore)
Line Input #1, Roger's Score, etc....
Close #1

ANY IDEAS!!!!!!!!!!!!!!!

High Score
I'm a newb with VB.I built a pong game, I added diffeculty settings, pausing, lives, and a score keeper. you avrage pong, right? Now what I want to do is add a high score window. Does anybody know how to?

High Score
hi can someone give me an example source for highscore list or advice me on doing highscore list, any help will be accepted . thanks in advance
-pentti

High Score Help
i have a simple game which counts how long it takes u to hit so many targets,

i have the time showing in a label, when the program ends how can i use the value in this box to save it as the players score?

Thanks in advanced Scotty

Help With Keeping Score.....
I have a simple taret game where it counts the time taken to clikc a target x ammount of times,

I take in a name at the start and the score is kept on a label and updated every second.

How can i output the name and score to a file?
Also how do i call this array back into a form???

Any help is appreciated

Scott

HIGH SCORE
ummm i was wandering how do i make a high score list?

Tic Tac Toe - Score Keeping
Hi. I am currently working on a tic tac toe game. I have the game working and now I want to extend it and add more functions. I am currently trying to keep the scores. I have a timer on form1 that checks to see if someone has won. I also have 2 text boxes of form3 that will keep the scores when someone has won. So my code for chcking for a winner is like this:


Code:
If a1.Caption = "X" And a2.Caption = "X" And a3.Caption = "X" Then
Label1.Caption = "X Wins"

I added a bit to this so that it would add 1 to the textbox in form 3.


Code:
a = Val(Form3.Text1.Text)
If a1.Caption = "X" And a2.Caption = "X" And a3.Caption = "X" Then
Label1.Caption = "X Wins"
Form3.Text1.Text = (a + 1)
End If

But because this is in a timer the code keeps checking itself so as soon as label1 says "X Wins" the numbers start counting up in the textbox untill I click on new game. I only want it to add 1 to the text box and not keep looping untill label1 isnt x wins.

How can I do this? Thanks!

Score In Blackjack
Hey there, I was wondering if anyone could help me out. Im creating a blackjack game using the cards.dll So far im doing not to bad with it with it. After I deal the cards I'm not sure on how to add their values together, or even on how to create the two values for player 1 and dealer, here is my code, also how would I calculate a new score after I have pressed the hit command?


Code:
Private Sub Form_Load()
Randomize
End Sub
Private Sub CMD_Deal_Click()
cdtDraw Me.hdc, 370, 75, Int((51 - 0 + 1) * Rnd + 0), 0, vbWhite
cdtDraw Me.hdc, 300, 75, Int((51 - 0 + 1) * Rnd + 0), 0, vbWhite
cdtDraw Me.hdc, 370, 300, Int((51 - 0 + 1) * Rnd + 0), 0, vbWhite
cdtDraw Me.hdc, 300, 300, Int((51 - 0 + 1) * Rnd + 0), 0, vbWhite


End Sub

Private Sub CMD_Hit_Click()
Static Xpos As Long
If Xpos = 0 Then
Xpos = 300
Else: Xpos = Xpos + 25
End If

cdtDraw Me.hdc, Xpos, 300, Int((51 - 0 + 1) * Rnd + 0), 0, vbWhite

End Sub


Private Sub CMD_Main_Menu_Click()
MainMenu.Show
Unload Me
End Sub

Just wondering how I would implement a scoring system into this game? any help is much appreciated.

Keeping Score
OK guys I am almost done with my Mutilplication game. It works great! It has a random generator to allow the computer to select what number you will be multiplying. It displays and generates sounds based on if the answer is right or wrong. One thing I would like to do is keep score. I

know how to accumulate items using module level variables in a form but how do you add totals from multiple forms and display them in one label in one form only?

Thanks!

Displaying 'Score'
Hello

This is another question about myquiz lol!

The user is asked 7 questions on seven seperate forms. Each tiem the user gets a question right, 1 is added to the 'counter' (called Score in my code)

In my final form i want to display the total Score - preferably in a label.

For example: "Your final score is..."

How can i get to display what the score is?

Tracking A Score
im writing a little trivia game only about 20 questions. i want to show the user the score at the end but it wont work. i have a varible named score and the code for tracking the score is

if optAns1.Value = True then score = score + 1 else score = score + 0

then on the last form i want to show the varible but i cant find any way that it outputs a number. i only get a blank caption for a label.

please help thanks,

turtleman14789

Average (mean) Score
edit: sorry let me be more clear
so far below, purpose of it is to determine's a person (freegumpher's) handicap, they must play atleast 3 games to determine that

adding to it is the loops below, the part i'm lost is that if their is more than one player, i need to determine the average (mean) of all the freegumpher's that inputted their scores here
thanks for the help

this is the code of what i have so far,

Code:
//Question 1: did you play at least 3 games?
//Question 2: Is there another player?
//ErrorMessage = “Answer must be Y or N, Please try again”


1If Question = "Y" or Question = "y" Then
2Do While Question <> “Y” or “y” or “N” or “n”
3Question = InputBox(ErrorMessage)
4Loop
5Input Question2
6While (Question = "Y" or Question ="y")
7INPUT Score1
8INPUT Score2
9INPUT Score3
//Calculations
10Total_Score = Score1 + Score2 + Score3
11Average = Total_Score / Games
12Display Score1
13Display Score2
14Display Score3
15Display Total_Score Display Average
//Handicap Calculation
16If Average >= Par Then
17Display "You have no handicap"
18 Else
19Display "Your Handicap is "; Par - Average
20End If
21Counter = Counter + 1
22 End While
23Else
24Display "You have not played enough Freegump to determine a handicap"
25End

Option W/ Score
i will have 10 questions with 4 multiple choice with one of those being the right answer... how you i put a score for the # of right answers on the bottom of the form in a label or textbox?

Need Help With Quiz Score
im trying to make a quiz and each time you get an answer right the score updates itself,any help?




thanx

Hi Score Table
how can i create a high score table using vb?
I have the players name in a textbox, and their score in a txtfile. Scores must be saved and sorted in numerical order each time the program is closed. Up to 10 names can be stored after which the person who is 10th goes off the table if the 11th person gets a better score than them

Tracking Score
Trying to keep track of each time a correct answer form is shown and a wrong answer form is shown. The code on the selection option is as follows:-

[VB CODE]
Private Sub Option1_Click(Index As Integer)

'If user chooses right answer
If Option1(Index).Caption = lblAns.Caption Then
'Update score

RIGHTTIMES = RIGHTTIMES + 1

'Switch off timer
Timer1.Enabled = False

'arrest Question mark
lblQuestion.Visible = True
Load frmScreen7
'Unload frmScreen3

With frmScreen5
'Update labels for next sum
frmScreen3.lblNum1 = lblNum1.Caption
frmScreen3.lblNum2 = lblNum2.Caption
frmScreen3.lblAns = lblAns.Caption

RIGHTTIMES = RIGHTTIMES + 1
.Show
Unload frmScreen3

End With

Else

WRONGTIMES = WRONGTIMES + 1

'Switch off Timer
Timer1.Enabled = False

'arrest Question mark
lblQuestion.Visible = True

Load frmScreen6
'Unload frmScreen5
With frmScreen6

frmScreen3.lblNum1 = lblNum1.Caption
frmScreen3.lblNum2 = lblNum2.Caption
frmScreen3.lblAns = lblAns.Caption
WRONGTIMES = WRONGTIMES + 1
.Show
Unload frmScreen3
End With

End If
End Sub
[/VB Code]

Then on form that shows score:-
[VB Code/]

Show
With frmScreen7
'Increment counter
RIGHTTIMES = RIGHTTIMES + 1

'Increment counter
WRONGTIMES = WRONGTIMES + 1

The score is incrementing but at irrational rates - nothing like reality. Have not inserted all the code for the last form. I am a bit confused does anyone know what is missing or why the rates are not tracking acurately.

Any help, anyone.

Thanks. Sert

Question On Score
Walter,

First, a small criticism, but not meant to be taken negatively:

You've created 3 other posts about the same question already.
You really should just keep one of them current.

Now,

I Agree with Megatron.

Attach the form, so we can see what you're doing.
That way, we have a direction to go with, and will allow us
to help you with your scoring problem.

Otherwise,

Would you like us to write the code off the top of our heads,
which more than likely would go in a completely different
direction than where you're already going?

Personally, I'm confused about the "Right" and "Wrong" Pictures anyways.

-Lou

Attachment To Score
I have gotten the score problem figured out . Now I have another problem I have establish form4 to get the correct score when ever someone clicks on the right images and subtract points when someone clicks on the wrong images. But now I need to know how do I get the information from form4 to go to form5 from the previous score label1. For example the users score is 50 at the end of the first level how do I get there score to stay 50 in the second level.

Question On Score
Where would I insert this code to get the users score from form4 on form5
form5.label1.caption= form4.label1.caption

Score Board
I want to make a high score board. I want to keep the three highest scores and nmes of people in a text file probably something like this:

"1000","billfaceuk"
"87","Fred Durst"

"Score","Person"

How would I go about setting such a feature up???

Hope this isn't to hard!

Keeping Score
I am making an quiz program. And I am finding it hard to get a label to add on numbers to it. So when they get a question right it will add points on the score. Please help

thanx

Michael Baynham 15

High Score
How would you set a program up so that i can have a high score feauture?
thanks,
Dan

Another Problem Trying To Keep A Score In VB6
Hi there,

I had a problem last week trying to keep and display a score in VB6 using radio/option buttons. I got some great advice but now its playing up again.
The format is:
A Question is asked, you choose from one of the 4 options then click next. DO this for all 5 to 10 questions then your score is displayed at the end.

I have added a module with the code:

Public score as integer

and in my forms the code looks like this:

Private Sub Option1_Click()
If Option1.Value Then
score = score + 0
End If
End Sub

Private Sub Option2_Click()
If Option2.Value Then
score = score + 0
End If
End Sub

Private Sub Option3_Click()
If Option3.Value Then
score = score + 0
End If
End Sub

Private Sub Option4_Click()

If Option4.Value Then
score = score + 1
End If
End Sub

The option with 'Score = score + 1' is correct answer. And on the last page I have a text box with the code:
Private Sub Form_Load()
Text1.Text = score
End Sub

The problem is this: If you answer all the questions correctly you get the correct score, but if you answer them all wrong it displays 2. and if you only get 3 right it displays 5 so it is obviously adding the 3 and 2 together.

Anyone know what could be causing this? or how to fix it? Any help would be great as I am about to explode!

Thanks
Bryan

Keeping Score
Does anyone now how to keep a score in a game in visual basic, i need something simple

Score Board
I'm doing tic tac toe. I am planning to show the scores of the users and computers using the same form. So, for each time the user or the computer loop, i need to add a timer to it so that it can update the scores. Refer to the source code at Private Sub CheckForWin(), i suggest to add a variable to store the scores for X and O,using:
(at line 419)
If XsInARow = 3 Then
player1=player1+1
Call XWins

If OsInARow = 3 Then
player2=player2+1
Call OWins

However i still thinking on how to add a timer to this function. Or like this?
If XsInARow = 3 Then
Call anyfunction() within the Private Sub Timer1_Timer() to calculate the scores?
Hereby i attached the files for references.Thanks

What Is This Top 10 Score On The Top Of This Forum
Is it the number of posts answered?

MIDI Score
Hello everybody,

I want to write a simple program that reads a MIDI file and displays the score of the file. Which API call do I use. I'm farely good in VB programming but I never did anything in MIDI. (other than play the files)

thanx in advance.

Rooc

Remember Variable / Score
hi,

ive hunted this forum and the net for an answer to this but i cant find it where i understand what to do.

ive made a program and you get a score at the end of it - it is held in a variable called yourScore and it is an integer.

it would be nice to have a top 5 scores where it saves the score to a file and then displays the top 5 scores to beat somehow when you load the program.

does anyone know a way of doing this or recommend a tutorial anywhere on it in realy simple terms? it only has to be realy basic

many thanks

simon

How To Make A Score Board! PLEASE HELP!
Right heres the problem people...!

Firstly I am a beginner at visual basic!

I have made a game up recently and would like to input a scoreboard, I have tried using "open" function and the "INI" way but all have been unsuccessful, please can you help me write a score board.

the inputs i wish to process into the score board are the variables:

name - name of player
score - their points after game over
level - and what level them got to before game over

If it is possible can you get the score board, in order of scores...?

thanx and hope to read some replies.

PLEASE HELP!

VB And Databases For High Score
I was just wondering if anyone knows about a good site, book or is willing to teach me how databases work with VB. The main purpose of this is that I want to make a game with a high score database. Everytime there is a high score I want the database to be updated and if the user wants to look at the high score then the database will be displayed.

I'd appreciate any help.

High Score List
Can Anyone Tell Me How To Program A High Score List Into A Simple Math Game For Children, I Need Only The Numbers And Only The Highest No Names Or Countdowns/ups

High Score Form
I'm a begginer at VB and i was wondering how to use another form to save high scores of a game i made, and also have them saved in the game so they stay there and wont just be wiped away when you exit the game. i was wondering if its simple or not and how to do it. thanks

High Score Table
ok i wanna add a high score table to my game (AA Gunner 2). During the game i have the score in a label in the top right corner of the screen, then when the player beats the game and has a high score, i want to put it in the high score table. But how do i save the high score table after the user exits?

High Score List
how could i create a text doc for a high score list.

High Score Form
This may be very simple but am pretty new to this. I am making a slot machine and i want to keep track of names and winnings of say the top 10. i am currently trying to use write and input to store the names and scores to a text file and then on a button click access a different form with 10 labels and read the data into those labels. some of the problems i am encountering are, that i cant limit the number of names and scores in text file. it keeps growing. also, one major things is that anyone who knows where the text file is can just go in and edit it to anything they want. does anyone know how or know where i can find some help on implementing a high score. am i even going about it right? thanks for any help

High Score Sorting
I know I've posted a message about this before, but I need some serious help with it. I can't seem to make some code that will sort scores and names that come out of a file. I'm trying to keep the person's name and score together, so once sorted I can put them on labels on a form for what ranking they are in.

Here's some things I know I have right.. which isn't much.

Open "c:Vbappshighscores.dat" For Input As #1
Do Until EOF(1)
Input #1, strTempName, intTempScore
'Sorting Code'
loop
close #1


I'm also looking for how to assign the player's name and score to labels, but I have no clue how to do this.

Can anyone help?

-----------------------
David aka. Nightmaresc

Copyright © 2005-08 www.BigResource.com, All rights reserved