Wrap every four posts within a div [duplicate]

Try this code:

            <?php
              $args = array(
                'post_type' => 'post', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC','cat' => '2',
              );
              $loop = new WP_Query( $args );
            ?>
            <?php if( $loop->have_posts() ): ?>


                  <?php $counter = 0; while ( $loop->have_posts() ) : $loop->the_post(); ?>
                    <?php if ($counter % 4 == 0 && $counter != 0): ?>
                      </div>
                      </div>
                    <?php endif; ?>
                    <?php if ($counter % 4 == 0 or $counter == 0): ?>
                      <div>
                      <div>
                    <?php endif; ?>
                      <div>
                      <div>
                      <h3><?php the_title(); ?></h3>
                      </div>                                                
                      </div>
                    <?php $counter++; endwhile; ?>        
                    </div>
                  </div>

            <?php endif; ?>

That’s a sample code I use in this kind of situations and works like a charm. Just replace the necessary divs with your custom game divs.