Posted: 28th Jan 2004 21:52
Here is some code that i wrote during second period at school in computer class after i was done with my work. This application is supposed to calculate the scores of a bowling game. It calculates three games and tells you your strike percentage, and spare percentage for each game, as well as the entire series. It also tells your average. Tell me what you think about it. And tell me if you think there is anything else i can do with it.
+ Code Snippet
   REM Frame 1
Counter=0
Repeat
   strike=0.0
   totalspare=0.0
   spare=0.0
   Print "Frame 1 - Throw 1"
   IE11:
   Input f1t1
      If f1t1>10
         Print "Invalid Entry"
         Goto IE11:
      Endif
      If f1t1=10
         Inc strike
         f1t2=0
         CLS
         Goto F2:
      Endif
   Print "Frame 1 - Throw 2"
   IE12:
   inc totalspare
   Input f1t2
      If f1t1+f1t2=10
         inc spare
      endif
      If f1t1+f1t2>10
         Print "Invalid Entry"
         Goto IE12:
      Endif


      REM Frame 2
   F2:
   CLS
   Print "Frame 2 - Throw 1"
   IE21:
   Input f2t1
      If f2t1>10
         Print "Invalid Entry"
         Goto IE21:
      Endif
      If f2t1=10
         Inc strike
         f2t2=0
         CLS
         Goto F3:
      Endif
   Print "Frame 2 - Throw 2"
   IE22:
   inc totalspare
   Input f2t2
      If f2t1+f2t2=10
         inc spare
      Endif
      If f2t1+f2t2>10
         Print "Invalid Entry"
         Goto IE22:
      Endif


      REM Frame 3
   F3:
   CLS
   Print "Frame 3 - Throw 1"
   IE31:
   Input f3t1
      If f3t1>10
         Print "Invalid Entry"
         Goto IE31:
      Endif
      If f3t1=10
         Inc strike
         f3t2=0
         CLS
         Goto F4:
      Endif
   Print "Frame 3 - Throw 2"
   IE32:
   inc totalspare
   Input f3t2
      If f3t1+f3t2=10
         inc spare
      Endif
      If f3t1+f3t2>10
         Print "Invalid Entry"
         Goto IE32:
      Endif


      REM Frame 4
   F4:
   CLS
   Print "Frame 4 - Throw 1"
   IE41:
   Input f4t1
      If f4t1>10
         Print "Invalid Entry"
         goto IE41:
      Endif
      If f4t1=10
         Inc strike
         f4t2=0
         CLS
         Goto F5:
      Endif
   Print "Frame 4 - Throw 2"
   IE42:
   inc totalspare
   Input f4t2
      If f4t1+f4t2=10
         inc spare
      Endif
      If f4t1+f4t2>10
         Print "Invalid Entry"
         Goto IE42:
      Endif


      REM Frame 5
   F5:
   CLS
   Print "Frame 5 - Throw 1"
   IE51:
   Input f5t1
      If f5t1>10
         Print "Invalid Entry"
         Goto IE51:
      Endif
      If f5t1=10
         Inc strike
         f5t2=0
         CLS
         Goto F6:
      Endif
   Print "Frame 5 - Throw 2"
   IE52:
   Inc totalspare
   Input f5t2
      If f5t1+f5t2=10
         Inc spare
      Endif
      If f5t1+f5t2>10
         Print "Invalid Entry"
         Goto IE52:
      Endif


      REM Frame 6
   F6:
   CLS
   Print "Frame 6 - Throw 1"
   IE61:
   Input f6t1
      If f6t1>10
         Print "Invalid Entry"
         Goto IE61:
      Endif
      If f6t1=10
         Inc strike
         f6t2=0
         CLS
         Goto F7:
      Endif
   Print "Frame 6 - Throw 2"
   IE62:
   Inc totalspare
   Input f6t2
      If f6t1+f6t2=10
         Inc spare
      Endif
      If f6t1+f6t2>10
         Print "Invalid Entry"
         Goto IE62:
      Endif


      REM Frame 7
   F7:
   CLS
   Print "Frame 7 - Throw 1"
   IE71:
   Input f7t1
      If f7t1>10
         Print "Invalid Entry"
         Goto IE71:
      Endif
      If f7t1=10
         Inc strike
         f7t2=0
         CLS
         Goto F8:
      Endif
   Print "Frame 7 - Throw 2"
   IE72:
   Inc totalspare
   Input f7t2
      If f7t1+f7t2=10
         Inc spare
      Endif
      If f7t1+f7t2>10
         Print "Invalid Entry"
         Goto IE72:
      Endif


      REM Frame 8
   F8:
   CLS
   Print "Frame 8 - Throw 1"
   IE81:
   Input f8t1
      If f8t1>10
         Print "Invalid Entry"
         Goto IE81:
      Endif
      If f8t1=10
         Inc strike
         f8t2=0
         CLS
         Goto F9:
      Endif
   Print "Frame 8 - Throw 2"
   IE82:
   Inc totalspare
   Input f8t2
      If f8t1+f8t2=10
         Inc spare
      Endif
      If f8t1+f8t2>10
         Print "Invalid Entry"
         Goto IE82:
      Endif


      REM Frame 9
   F9:
   CLS
   Print "Frame 9 - Throw 1"
   IE91:
   Input f9t1
      If f9t1>10
         Print "Invalid Entry"
         Goto IE91:
      Endif
      If f9t1=10
         Inc strike
         f9t2=0
         CLS
         Goto F10:
      Endif
   Print "Frame 9 - Throw 2"
   IE92:
   Inc totalspare
   Input f9t2
      If f9t1+f9t2=10
         inc spare
      Endif
      If f9t1+f9t2>10
         Print "Invalid Entry"
         Goto IE92:
      Endif


      REM Frame 10
   F10:
   CLS
   Print "Frame 10 - Throw 1"
   IE101:
   Input f10t1
      If f10t1>10
         Print "Invalid Entry"
         Goto IE101:
      Endif
      If f10t1=10
         Inc strike
      Endif
      If f10t1<>10
         Inc totalspare
      Endif
   Print "Frame 10 - Throw 2"
   IE102:
   Input f10t2
      If f10t1=10 and f10t2>10
         Print "Invalid entry"
         Goto IE102:
      Endif
      If f10t1<>10 and f10t1+f10t2>10
         Print "Invalid Entry"
         Goto IE102:
      Endif
      If f10t2=10
         Inc strike
      Endif
      If f10t1+f10t2=10 and f10t1<>10
         inc spare
      Endif
   f10t3=0
      If f10t1=10 or f10t1+f10t2=10
         Print "Frame 10 - Throw 3"
         IE103:
         Input f10t3
            If f10t1=10 and f10t2+f10t3>10 and f10t2<>10
               Print "Invalid Entry"
               Goto IE103:
            Endif
            If f10t1=10 and f10t2=10 and f10t3>10
               Print "Invalid Entry"
               Goto IE103:
            Endif
            If f10t1+f10t2=10 and f10t1<>10 and f10t3>10
               Print "Invalid Entry"
               Goto IE103:
            Endif
            If f10t3=10 and f10t1=10 and f10t2=10 or f10t1+f10t2=10 and f10t3=10
               Inc strike
            Endif
            If f10t1=10 and f10t2<>10
               Inc totalstrike
            Endif
            If f10t1<>10 and f10t1+f10t2=10
               Inc strike
            Endif
            If f10t1=10 and f10t2<>10 and f10t2+f10t3=10
               Inc strike
            Endif
      Endif

   CLS


      REM Frame 1
   frame1=f1t1+f1t2
      If f1t1=10
         frame1=10+f2t1+f2t2
            If f2t1=10
               frame1=10+10+F3t1
            Endif
      Endif

      If f1t1+f1t2=10 and f1t2<> 0
         frame1=10+f2t1
      Endif

      REM Frame 2
   frame2=f2t1+f2t2
      If f2t1=10
         frame2=10+f3t1+f3t2
            If f3t1=10
               frame2=10+10+F4t1
            Endif
      Endif

      If f2t1+f2t2=10 and f2t2<> 0
         frame2=10+f3t1
      Endif

      REM Frame 3
   frame3=f3t1+f3t2
      If f3t1=10
         frame3=10+f4t1+f4t2
            If f4t1=10
               frame3=10+10+F5t1
            Endif
      Endif

      If f3t1+f3t2=10 and f3t2<> 0
         frame3=10+f4t1
      Endif

      REM Frame 4
   frame4=f4t1+f4t2
      If f4t1=10
         frame4=10+f5t1+f5t2
            If f5t1=10
               frame4=10+10+F6t1
            Endif
      Endif

      If f4t1+f4t2=10 and f4t2<> 0
         frame4=10+f5t1
      Endif

      REM Frame 5
   frame5=f5t1+f5t2
      If f5t1=10
         frame5=10+f6t1+f6t2
            If f6t1=10
               frame5=10+10+F7t1
            Endif
      Endif

      If f5t1+f5t2=10 and f5t2<> 0
         frame5=10+f6t1
      Endif

      REM Frame 6
   frame6=f6t1+f6t2
      If f6t1=10
         frame6=10+f7t1+f7t2
            If f7t1=10
               frame6=10+10+F8t1
            Endif
      Endif

      If f6t1+f6t2=10 and f6t2<> 0
         frame6=10+f7t1
      Endif

      REM Frame 7
   frame7=f7t1+f7t2
      If f7t1=10
         frame7=10+f8t1+f8t2
            If f8t1=10
               frame7=10+10+F9t1
            Endif
      Endif

      If f7t1+f7t2=10 and f7t2<> 0
         frame7=10+f8t1
      Endif

      REM Frame 8
   frame8=f8t1+f8t2
      If f8t1=10
         frame8=10+f9t1+f9t2
            If f9t1=10
               frame8=10+10+F10t1
            Endif
      Endif

      If f8t1+f8t2=10 and f8t2<> 0
         frame8=10+f9t1
      Endif

      REM Frame 9
   frame9=f9t1+f9t2
      If f9t1=10
         frame9=10+f10t1+f10t2
      Endif

      If f9t1+f9t2=10 and f9t2<> 0
         frame9=10+f10t1
      Endif

      REM Frame 10
   frame10=f10t1+f10t2+f10t3

   Game=frame1+frame2+frame3+frame4+frame5+frame6+frame7+frame8+frame9+frame10
   If counter=0
      Print "Your score for your first game is "; Game;"."
      strikepercent1=(strike/12.0)*100.0
      Print "Your strike percentage for your first game is ";strikepercent1;"%."
      sparepercent1=(spare*1.0/totalspare*1.0)*100.0
      Print "Your spare percentage for your first game is ";sparepercent1;"%."
      Print "Press ENTER to calculate the score of your second game."
      Input nothing
      Game1=Game
      strike1=strike
      spare1=spare
      totalspare1=totalspare
      CLS
   Endif
   IF counter=1
      Print "Your score for the first game is ";Game
      strikepercent2=(strike/12.0)*100.0
      Print "Your strike percentage for your second game is ";strikepercent2;"%."
      sparepercent2=(spare*1.0/totalspare*1.0)*100.0
      Print "Your spare percentage for your second game is ";sparepercent2;"%."
      Print "Press ENTER to calculate the score of your third game."
      Game2=Game
      strike2=strike
      spare2=spare
      totalspare2=totalspare
      Input nothing
      CLS
   Endif
   IF counter=2
      Print "Your Score For Your Third Game Is ";Game
      strikepercent3=(strike/12.0)*100.0
      Print "Your strike percentage for your third game is ";strikepercent3;"%."
      sparepercent3=(spare*1.0/totalspare*1.0)*100.0
      Print "Your spare percentage for your second game is ";sparepercent3;"%."
      Print "Press ENTER to see the stats for your series."
      Game3=Game
      strike3=strike
      spare3=spare
      totalspare3=totalspare
      Input nothing
      CLS
   Endif




   Inc counter
Until counter=3
Series=Game1+Game2+Game3
Print "Your Series is ";Series;"."
Average=Series/3
Print "Your Average is ";Average;"."
seriesstrike=((strike1+strike2+strike1)/36.0)*100.0
Print "Your strike percentage for your series is ";seriesstrike;"%."
seriesspare=(((spare1*1.0)+(spare2*1.0)+(spare3*1.0))/((totalspare1*1.0)+(totalspare2*1.0)+(totalspare3*1.0)))*100
Print "Your spare percentage for your series is ";seriesspare;"%."
Print "Press ENTER To Exit This Program"
Input nothing3


thanks