connect_four_cli 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/connect_four_cli/board.rb +10 -0
- data/lib/connect_four_cli/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 42e0dd973e8f843cbb6358f150fd18dbad74d9f8
         | 
| 4 | 
            +
              data.tar.gz: 97d29400a9a64326c5783164c5184941fe02840d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9bf928eca8187f58ff2fbb31eff63911687190700de96c81013cbd97bcefe6a66f68f35870d0063a81e5ce16cb2b2d471a1c9e2d15771efd74412689ca3cdfe6
         | 
| 7 | 
            +
              data.tar.gz: 0663a1762037b11a2e0a2cbd8097d667b127d9975c4271bc8c7f1c44c7cec5d5651b559a3f0e3afddce1f13877500f9b6fc51cb4884ca09bb9be0405d2c09c47
         | 
| @@ -107,6 +107,16 @@ module ConnectFourCli | |
| 107 107 | 
             
                        moves << possible_move
         | 
| 108 108 | 
             
                      end
         | 
| 109 109 | 
             
                    end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                    other_moves = all_directions_from(2,possible_move.reverse).map.with_index do |ray2, i|
         | 
| 112 | 
            +
                      ray2 << all_directions_from(1,possible_move.reverse)[i][0]
         | 
| 113 | 
            +
                    end
         | 
| 114 | 
            +
                    other_moves.each do |ray|
         | 
| 115 | 
            +
                      color = ray[0].color
         | 
| 116 | 
            +
                      if ray.all? { |checker| checker.checker? && checker.color == color }
         | 
| 117 | 
            +
                        moves << possible_move
         | 
| 118 | 
            +
                      end
         | 
| 119 | 
            +
                    end
         | 
| 110 120 | 
             
                  end
         | 
| 111 121 | 
             
                  moves
         | 
| 112 122 | 
             
                end
         |