1. What is the highest score you can obtain in a standard game of bowling if your cumulative score in
each of the ten frames is required to be a prime number?
2. What is the lowest score you can obtain in a standard game of bowling if your cumulative score in
each of the ten frames is required to be a prime number and for each throw you knock
down a prime number of pins?
The next two questions refer to 3-6-9 bowling. The difference in 3-6-9 bowling and the standard game is the 3rd, 6th and 9th frame already have strikes recorded.
3. What is the highest score you can obtain in a game of 3-6-9 bowling if your cumulative score in each of the ten frames is required to be a prime number?
4. What is the lowest score you can obtain if your cumulative score in each of the ten frames is required to be a prime number and for each throw (
excluding the pre-recorded throws) you knock down a prime number of pins?
The first score sheet represents Games #1 and #2.
The second is for use with Games #3 and #4.
| 1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | | 10 | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| 1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | | 10 | | | | | |
| | | | | | | X | | | | | | | | | X | | | | | | | | | X | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
One Scoring reference is
here should you need one.
(In reply to
Just part 1. by Leming)
Private Sub cmdStart_Click()
goingBack = ""
Play 1
Print sCtr
Print "ended"
End Sub
Sub ReportIt()
If Frame(10) < maxScore Then Exit Sub
maxScore = Frame(10)
Cls
sCtr = sCtr + 1
For I = 1 To throwNo
If I > throwNo Then Exit For
If Throw(I) = 10 Then Print " x "; Else Print Throw(I);: I = I + 1: Print Throw(I);
Next
Print
For I = 1 To 10
Print Frame(I);: Print " ";
Next
Print: Print sCtr
End Sub
Sub Play(Fr)
DoEvents
spareFlag = 0
If Fr = 3 Or Fr = 6 Or Fr = 9 Then setVal = 10 Else setVal = 1
For N = 10 To setVal Step -1
throwNo = throwNo + 1
Throw(throwNo) = N
If N < 10 Then
For N2 = 0 To 10 - N
throwNo = throwNo + 1
Throw(throwNo) = N2
If goingBack = "xx" Then
Frame(Fr - 2) = Frame(Fr - 2) + N
Frame(Fr - 1) = Frame(Fr - 1) + N + N2
Frame(Fr) = Frame(Fr - 1) + N + N2
If N2 = 10 - N Then goingBack = "/" Else goingBack = ""
If fnIsPrime(Frame(Fr - 2)) And fnIsPrime(Frame(Fr - 1)) Then
If goingBack = "/" Or fnIsPrime(Frame(Fr)) Then
If Fr = 10 Then
If goingBack = "/" Then
For N3 = 0 To 10 - N1 - N2
throwNo = throwNo + 1
Throw(throwNo) = N3
Frame(Fr) = Frame(Fr) + N3
If fnIsPrime(Frame(Fr)) Then ReportIt
Frame(Fr) = Frame(Fr) - N3
throwNo = throwNo - 1
Next
Else
ReportIt
End If
Else
Play Fr + 1
End If
End If
End If
Frame(Fr - 2) = Frame(Fr - 2) - N
Frame(Fr - 1) = Frame(Fr - 1) - N - N2
Frame(Fr) = 0
goingBack = "xx"
ElseIf goingBack = "x" Then
If N2 < 10 - N Or spareFlag = 0 Then
Frame(Fr - 1) = Frame(Fr - 1) + N + N2
Frame(Fr) = Frame(Fr - 1) + N + N2
If N2 = 10 - N Then goingBack = "/": spareFlag = 1 Else goingBack = ""
If fnIsPrime(Frame(Fr - 1)) Then
If goingBack = "/" Or fnIsPrime(Frame(Fr)) Then
If Fr = 10 Then
If goingBack = "/" Then
For N3 = 0 To 10 - N1 - N2
throwNo = throwNo + 1
Throw(throwNo) = N3
Frame(Fr) = Frame(Fr) + N3
If fnIsPrime(Frame(Fr)) Then ReportIt
Frame(Fr) = Frame(Fr) - N3
throwNo = throwNo - 1
Next
Else
ReportIt
End If
Else
Play Fr + 1
End If
End If
End If
Frame(Fr - 1) = Frame(Fr - 1) - N - N2
Frame(Fr) = 0
goingBack = "x"
End If
ElseIf goingBack = "/" Then
Frame(Fr - 1) = Frame(Fr - 1) + N
Frame(Fr) = Frame(Fr - 1) + N + N2
If N2 = 10 - N Then goingBack = "/" Else goingBack = ""
If fnIsPrime(Frame(Fr - 1)) Then
If goingBack = "/" Or fnIsPrime(Frame(Fr)) Then
If Fr = 10 Then
If goingBack = "/" Then
For N3 = 0 To 10 - N1 - N2
throwNo = throwNo + 1
Throw(throwNo) = N3
Frame(Fr) = Frame(Fr) + N3
If fnIsPrime(Frame(Fr)) Then ReportIt
Frame(Fr) = Frame(Fr) - N3
throwNo = throwNo - 1
Next
Else
ReportIt
End If
Else
Play Fr + 1
End If
End If
End If
Frame(Fr - 1) = Frame(Fr - 1) - N
Frame(Fr) = 0
goingBack = "/"
Else
If N2 < 10 - N Or spareFlag = 0 Then
Frame(Fr) = Frame(Fr - 1) + N + N2
If N2 = 10 - N Then goingBack = "/": spareFlag = 1 Else goingBack = ""
If goingBack = "/" Or fnIsPrime(Frame(Fr)) Then
If Fr = 10 Then
If goingBack = "/" Then
For N3 = 0 To 10 - N1 - N2
throwNo = throwNo + 1
Throw(throwNo) = N3
Frame(Fr) = Frame(Fr) + N3
If fnIsPrime(Frame(Fr)) Then ReportIt
Frame(Fr) = Frame(Fr) - N3
throwNo = throwNo - 1
Next
Else
ReportIt
End If
Else
Play Fr + 1
End If
End If
Frame(Fr) = 0
goingBack = ""
End If
End If
throwNo = throwNo - 1
Next
Else
' have a strike
If goingBack = "xx" Then
Frame(Fr - 2) = Frame(Fr - 2) + 10
Frame(Fr - 1) = Frame(Fr - 1) + 10
Frame(Fr) = Frame(Fr - 1) + 10
If Fr = 10 Then
If fnIsPrime(Frame(Fr - 2)) Then
For N2 = 0 To 10
For N3 = 0 To 10
Frame(Fr - 1) = Frame(Fr - 1) + N2
Frame(Fr) = Frame(Fr - 1) + 10 + N2 + N3
Throw(throwNo + 1) = N2: Throw(throwNo + 2) = N3
throwNo = throwNo + 2
If fnIsPrime(Frame(Fr - 1)) And fnIsPrime(Frame(Fr)) Then
ReportIt
End If
throwNo = throwNo - 2
Frame(Fr - 1) = Frame(Fr - 1) - N2
Frame(Fr) = 0
Next
Next
End If
Else
Play Fr + 1
End If
Frame(Fr - 2) = Frame(Fr - 2) - 10
Frame(Fr - 1) = Frame(Fr - 1) - 10
Frame(Fr) = 0
ElseIf goingBack = "x" Then
Frame(Fr - 1) = Frame(Fr - 1) + 10
Frame(Fr) = Frame(Fr - 1) + 10
If Fr = 10 Then
For N2 = 0 To 10
For N3 = 0 To 10
Frame(Fr - 1) = Frame(Fr - 1) + N2
Frame(Fr) = Frame(Fr - 1) + 10 + N2 + N3
Throw(throwNo + 1) = N2: Throw(throwNo + 2) = N3
throwNo = throwNo + 2
If fnIsPrime(Frame(Fr - 1)) And fnIsPrime(Frame(Fr)) Then
ReportIt
End If
throwNo = throwNo - 2
Frame(Fr - 1) = Frame(Fr - 1) - N2
Frame(Fr) = 0
Next
Next
Else
goingBack = "xx"
Play Fr + 1
goingBack = "x"
End If
Frame(Fr - 1) = Frame(Fr - 1) - 10
Frame(Fr) = 0
ElseIf goingBack = "/" Then
Frame(Fr - 1) = Frame(Fr - 1) + 10
Frame(Fr) = Frame(Fr - 1) + 10
If Fr = 10 Then
For N2 = 0 To 10
For N3 = 0 To 10
Frame(Fr) = Frame(Fr - 1) + 10 + N2 + N3
Throw(throwNo + 1) = N2: Throw(throwNo + 2) = N3
throwNo = throwNo + 2
If fnIsPrime(Frame(Fr - 1)) And fnIsPrime(Frame(Fr)) Then
ReportIt
End If
throwNo = throwNo - 2
Frame(Fr) = 0
Next
Next
Else
goingBack = "x"
Play Fr + 1
goingBack = "/"
End If
Frame(Fr - 1) = Frame(Fr - 1) - 10
Frame(Fr) = 0
Else
Frame(Fr) = Frame(Fr - 1) + 10
If Fr = 10 Then
For N2 = 0 To 10
For N3 = 0 To 10
Frame(Fr) = Frame(Fr - 1) + 10 + N2 + N3
Throw(throwNo + 1) = N2: Throw(throwNo + 2) = N3
throwNo = throwNo + 2
If fnIsPrime(Frame(Fr)) Then
ReportIt
End If
throwNo = throwNo - 2
Frame(Fr) = 0
Next
Next
Else
goingBack = "x"
Play Fr + 1
goingBack = ""
End If
Frame(Fr) = 0
End If
End If
throwNo = throwNo - 1
Next
End Sub
Function fnIsPrime(Num)
Select Case Num
Case 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, _
257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401
r = 1
Case Else
r = 0
End Select
fnIsPrime = r
End Function
Many ways were found of getting a score of 211, the maximum that my program found in the time I allotted it.
Part 1. 211:
9 1 3 7 8 2 x 9 1 x x 2 8 x x x x
13 31 51 71 91 113 131 151 181 211
Of course the lowest possible score would be the trivial 2, completed in the first frame and repeated all the way down:
alternate to part 1 -- trying for lowest score:
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 2 2 2 2 2 2 2 2 2
|
Posted by Charlie
on 2007-11-28 15:47:58 |