<commit_before>package net.rk.splendid;

import net.rk.splendid.dto.GameRef;
import net.rk.splendid.exceptions.PlayerCountOutOfRangeException;
import net.rk.splendid.exceptions.PlayerNameEmptyException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public final class NewGameController {
  @RequestMapping("/new")
  public GameRef newGame(
      @RequestParam("playerName") String playerName,
      @RequestParam("playerCount") int playerCount) {
    if (playerName.isEmpty()) {
      throw new PlayerNameEmptyException();
    }
    if (playerCount < 2 || playerCount > 5) {
      throw new PlayerCountOutOfRangeException(playerCount);
    }

    return new GameRef(UUID.randomUUID().toString());
  }
}<commit_msg>Creating game in DAO.<commit_after>package net.rk.splendid;

import net.rk.splendid.dao.GameDao;
import net.rk.splendid.dto.GameRef;
import net.rk.splendid.exceptions.PlayerCountOutOfRangeException;
import net.rk.splendid.exceptions.PlayerNameEmptyException;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public final class NewGameController {
  @RequestMapping("/new")
  public GameRef newGame(
      @RequestParam("playerName") String playerName,
      @RequestParam("playerCount") int playerCount) {
    if (playerName.isEmpty()) {
      throw new PlayerNameEmptyException();
    }
    if (playerCount < 2 || playerCount > 5) {
      throw new PlayerCountOutOfRangeException(playerCount);
    }

    return GameDao.createGame(playerCount);
  }
}
{'fraction_non_alphanumeric': 0.10492845786963434, 'fraction_numerical': 0.0021197668256491787, 'mean_word_length': 5.149837133550489, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3744618', 'n_tokens_mistral': 557, 'n_tokens_neox': 546, 'n_words': 100}