Beispiel #1
0
 def test_0000000000_0(self):
     """
     Todos as jogadas com o zero retorna 0 como pontuacao
     """
     self.assertEquals(bowling([
     (0,0),
     (0,0),
     (0,0),
     (0,0),
     (0,0)
     ])
     , 0)
Beispiel #2
0
 def test_ultimo_spare_espera_uma_jogada_extra_55(self):
     """
     Ocorre spare em 2 rodadas seguidas
     """
     self.assertEquals(bowling([
     (3,7),
     (5,5),
     (4,1),
     (2,5),
     (5,5,4)
     ])
     , 55)
Beispiel #3
0
 def test_dois_spares_seguidos_49(self):
     """
     Ocorre spare em 2 rodadas seguidas
     """
     self.assertEquals(bowling([
     (3,7),
     (5,5),
     (4,1),
     (2,5),
     (5,3)
     ])
     , 49)
def go_bowl(match, team):
    print('BOWLING ' + team[0])
    disp_players(team)
    b_ch = int(input('CHOOSE THE BOWLER: '))
    #creation of bowler
    bowl_temp = bowling(team[b_ch])
    #bowling object append
    bowl_list.append(bowl_temp)
    #bowling dict append
    bowl_stats.append(bowl_temp.b_stats)
    scoreboard(match.match_stats, bat_stats, bowl_stats)
    return team, bowl_temp
Beispiel #5
0
 def test_3152412553_31(self):
     """
     Nenhum spare ou strike, somente soma os elementos
     """
     self.assertEquals(bowling([
     (3,1),
     (5,2),
     (4,1),
     (2,5),
     (5,3)
     ])
     , 31)
Beispiel #6
0
 def test_3752412553_42(self):
     """
     Ocorre spare na primeira jogada
     """
     self.assertEquals(bowling([
     (3,7),
     (5,2),
     (4,1),
     (2,5),
     (5,3)
     ])
     , 42)
def choose_bowler(bowl, bowler):
    bowl = list(bowl)
    bowl.remove(bowler.bname)
    disp_players(bowl)
    b_ch = int(input('CHOOSE THE BOWLER'))
    for bowlers in bowl_list:
        if bowlers.bname == bowl[b_ch] and bowl[b_ch] != bowler.bname:
            bowler = bowlers
            break
    else:
        bowler = bowling(bowl[b_ch])
        bowl_list.append(bowler)
    return bowler
 def test_derrubou_5_pinos_em_rodadas_e_tentativas_diferentes(self):
     game = ((1,1),(1,1),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(5, bowling(game))    
Beispiel #9
0
def test_final_x():
    assert_equals(bowling("111111111111111111X11"),30)
Beispiel #10
0
 def test_strike_na_primeira_rodada(self):
     game = ((10, 0), (1, 0), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0), (0, 0))
     self.assertEqual(14, bowling(game))
 def test_derrubou_2_pinos_na_primeira_rodada(self):
     game = ((2,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(2, bowling(game))
Beispiel #12
0
 def test_spare_na_primeira_rodada(self):
     game = ((5, 5), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(12, bowling(game))
Beispiel #13
0
 def test_spare_na_segunda_rodada(self):
     game = ((5, 4), (6, 4), (0, 1), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(21, bowling(game))
Beispiel #14
0
def test_5slash():
    assert_equals(bowling("5/5/5/5/5/5/5/5/5/5/5"), 150)
Beispiel #15
0
 def test_derrubou_3_pinos_na_primeira_rodada_em_tentativas_diferentes(
         self):
     game = ((2, 1), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(3, bowling(game))
Beispiel #16
0
def test_fast_perfect_game():
    assert_equals(bowling("X X 3/ X X X X X X XXX"),273)
Beispiel #17
0
def test_999():
    assert_equals(bowling("9-9-9-9-9-9-9-9-9-9-"), 90)
Beispiel #18
0
def test_perfect_game():
    assert_equals(bowling("X X X X X X X X X XXX"),300)
Beispiel #19
0
def test_last_frame_full():
    assert_equals(bowling("11 11 X 11 11 11 11 11 11 XXX"),58)
Beispiel #20
0
def test_good_game():
    assert_equals(bowling("1111X111111111111X11"),40)
 def test_dois_spares(self):
     game = ((4,6),(5,5),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(32, bowling(game))            
Beispiel #22
0
def test_168():
    assert_equals(bowling("X7/729/XXX236/7/3"), 168)
Beispiel #23
0
def test_final_spare():
    assert_equals(bowling("1111111111111111111/1"),29)
Beispiel #24
0
def test_final():
    assert_equals(bowling("111111111111111111X--"),28)
Beispiel #25
0
 def test_derrubou_5_pinos_em_rodadas_e_tentativas_diferentes(self):
     game = ((1, 1), (1, 1), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(5, bowling(game))
Beispiel #26
0
def test_final2():
    assert_equals(bowling("1111111111111111111/-"),28)
Beispiel #27
0
 def test_derrubou_0_pino(self):
     game = ((0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(0, bowling(game))
Beispiel #28
0
def test_final677():
    assert_equals(bowling("111111111111111111X-/"),38)
Beispiel #29
0
 def test_spare_na_segunda_rodada_com_proximo_dif_de_1(self):
     game = ((5, 4), (6, 4), (4, 1), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(29, bowling(game))
Beispiel #30
0
def test_total_miss():
    assert_equals(bowling("--------------------"),0)
Beispiel #31
0
 def test_dois_spares(self):
     game = ((4, 6), (5, 5), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(32, bowling(game))
 def test_spare_na_segunda_rodada(self):
     game = ((5,4),(6,4),(0,1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(21, bowling(game))
 def test_derrubou_3_pinos_na_primeira_rodada_em_tentativas_diferentes(self):
     game = ((2,1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(3, bowling(game))
 def test_strike_na_primeira_rodada(self):
     game = ((10,0),(1,0),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(14, bowling(game))  
 def test_spare_na_primeira_rodada(self):
     game = ((5,5),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(12, bowling(game))
Beispiel #36
0
def test_slash_irnxwo():
    assert_equals(bowling("1/11111111111111111/1"),38)
 def test_spare_na_segunda_rodada_com_proximo_dif_de_1(self):
     game = ((5,4),(6,4),(4,1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(29, bowling(game))
Beispiel #38
0
 def test_derrubou_1_pino_na_primeira_rodada(self):
     game = ((1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(1, bowling(game))
 def test_derrubou_0_pino(self):
     game = ((0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(0, bowling(game))
Beispiel #40
0
 def test_derrubou_2_pinos_na_primeira_rodada(self):
     game = ((2, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0),
             (0, 0), (0, 0))
     self.assertEqual(2, bowling(game))
 def test_derrubou_1_pino_na_primeira_rodada(self):
     game = ((1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0))
     self.assertEqual(1, bowling(game))
Beispiel #42
0
def test_low_score():
    assert_equals(bowling("11111111111111111111"),20)