<commit_before>#include <stdlib.h>
#include <string.h>

#include "game.h"
#include "tetromino_srs.h"
#include <time.h>

static TrnTetrominoType getRandomTrnTetrominoType(Game* game)
{
#ifdef WITH_MOCK
    static int tetromino_type_index = 0;
    int number_of_tetromino_type = 2;
    TrnTetrominoType mocked_tetromino_type[2] = 
      {TRN_TETROMINO_J, TRN_TETROMINO_L};

    TrnTetrominoType tetrominoType = 
      mocked_tetromino_type[tetromino_type_index];
    tetromino_type_index = (tetromino_type_index + 1) % 
                                     number_of_tetromino_type;
    return tetrominoType;
#else
    return rand() % TRN_NUMBER_OF_TETROMINO;
#endif
}

void trn_game_new_piece(Game* game)
{
  if (game->status != TRN_GAME_ON)
     return;

  game->piece->topLeftCorner.rowIndex = 0;
  game->piece->topLeftCorner.columnIndex = (game->grid->numberOfColumns - 
                                          TRN_TETROMINO_GRID_SIZE)/2;
  game->piece->angle = TRN_ANGLE_0;
  
  game->piece->type = getRandomTrnTetrominoType(game);
  
  if ( trn_grid_can_set_cells_with_piece(game->grid,game->piece) )
    trn_grid_set_cells_with_piece(game->grid, 
                                  game->piece,
                                  game->piece->type);
  else
    game->status = TRN_GAME_OVER;
}

Game* trn_game_new(int numberOfRows, int numberOfColumns)
{
    srand(time(NULL));
    Game* game = (Game*) malloc(sizeof(Game));<commit_msg>Fix unused variable warning<commit_after>#include <stdlib.h>
#include <string.h>

#include "game.h"
#include "tetromino_srs.h"
#include <time.h>

static TrnTetrominoType getRandomTrnTetrominoType(Game* game)
{
    static int tetromino_type_index = 0;
    int number_of_tetromino_type = 2;
    TrnTetrominoType mocked_tetromino_type[2] = 
      {TRN_TETROMINO_J, TRN_TETROMINO_L};

    TrnTetrominoType tetrominoType = 
      mocked_tetromino_type[tetromino_type_index];
    tetromino_type_index = (tetromino_type_index + 1) % 
                                     number_of_tetromino_type;
    return tetrominoType;
}

static TrnTetrominoType mockGetRandomTrnTetrominoType()
{
    return rand() % TRN_NUMBER_OF_TETROMINO;
}

void trn_game_new_piece(Game* game)
{
  if (game->status != TRN_GAME_ON)
     return;

  game->piece->topLeftCorner.rowIndex = 0;
  game->piece->topLeftCorner.columnIndex = (game->grid->numberOfColumns - 
                                          TRN_TETROMINO_GRID_SIZE)/2;
  game->piece->angle = TRN_ANGLE_0;
  
#ifdef WITH_MOCK
  game->piece->type = getRandomTrnTetrominoType(game);
#else
  game->piece->type = mockGetRandomTrnTetrominoType();
#endif
  
  if ( trn_grid_can_set_cells_with_piece(game->grid,game->piece) )
    trn_grid_set_cells_with_piece(game->grid, 
                                  game->piece,
                                  game->piece->type);
  else
    game->status = TRN_GAME_OVER;
}

Game* trn_game_new(int numberOfRows, int numberOfColumns)
{
    srand(time(NULL));
    Game* game = (Game*) malloc(sizeof(Game));
{'fraction_non_alphanumeric': 0.10431893687707641, 'fraction_numerical': 0.004651162790697674, 'mean_word_length': 3.0524899057873487, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '44744', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1093, 'n_words': 157}