Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 4
0
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
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 7
0
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
Exemplo n.º 8
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))    
Exemplo n.º 9
0
def test_final_x():
    assert_equals(bowling("111111111111111111X11"),30)
Exemplo n.º 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))
Exemplo n.º 11
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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 14
0
def test_5slash():
    assert_equals(bowling("5/5/5/5/5/5/5/5/5/5/5"), 150)
Exemplo n.º 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))
Exemplo n.º 16
0
def test_fast_perfect_game():
    assert_equals(bowling("X X 3/ X X X X X X XXX"),273)
Exemplo n.º 17
0
def test_999():
    assert_equals(bowling("9-9-9-9-9-9-9-9-9-9-"), 90)
Exemplo n.º 18
0
def test_perfect_game():
    assert_equals(bowling("X X X X X X X X X XXX"),300)
Exemplo n.º 19
0
def test_last_frame_full():
    assert_equals(bowling("11 11 X 11 11 11 11 11 11 XXX"),58)
Exemplo n.º 20
0
def test_good_game():
    assert_equals(bowling("1111X111111111111X11"),40)
Exemplo n.º 21
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))            
Exemplo n.º 22
0
def test_168():
    assert_equals(bowling("X7/729/XXX236/7/3"), 168)
Exemplo n.º 23
0
def test_final_spare():
    assert_equals(bowling("1111111111111111111/1"),29)
Exemplo n.º 24
0
def test_final():
    assert_equals(bowling("111111111111111111X--"),28)
Exemplo n.º 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))
Exemplo n.º 26
0
def test_final2():
    assert_equals(bowling("1111111111111111111/-"),28)
Exemplo n.º 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))
Exemplo n.º 28
0
def test_final677():
    assert_equals(bowling("111111111111111111X-/"),38)
Exemplo n.º 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))
Exemplo n.º 30
0
def test_total_miss():
    assert_equals(bowling("--------------------"),0)
Exemplo n.º 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))
Exemplo n.º 32
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))
Exemplo n.º 33
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))
Exemplo n.º 34
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))  
Exemplo n.º 35
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))
Exemplo n.º 36
0
def test_slash_irnxwo():
    assert_equals(bowling("1/11111111111111111/1"),38)
Exemplo n.º 37
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))
Exemplo n.º 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))
Exemplo n.º 39
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))
Exemplo n.º 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))
Exemplo n.º 41
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))
Exemplo n.º 42
0
def test_low_score():
    assert_equals(bowling("11111111111111111111"),20)