<commit_before>package io.resourcepool.hvsz.service.impl;

import io.resourcepool.hvsz.persistance.dao.DaoMapDb;
import io.resourcepool.hvsz.persistance.models.Game;
import io.resourcepool.hvsz.persistance.models.GameStateEnum;
import io.resourcepool.hvsz.persistance.models.GameStatus;
import io.resourcepool.hvsz.persistance.models.Life;
import io.resourcepool.hvsz.service.ZombieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ZombieServiceImpl implements ZombieService {
    @Autowired
    private DaoMapDb dao;

    @Override
    public boolean kill(String lifeToken) {
        Game g = dao.get(1L);

        GameStatus status = g.getStatus();

            Boolean lifeFound = false;
            for (Life l : status.getLives()) {
                if (l.getToken().toString().equals(lifeToken)) {
                    l.setAlive(false);
                    lifeFound = true;
                    //Decrement nbHumaneAlive in game status
                    status.setNbHumanAlive(status.getNbHumanAlive() - 1);
                }
            }
            if (status.getNbHumanAlive() + status.getNbLifeLeft() <= 0) {
                status.setGameState(GameStateEnum.ZOMBIE_VICTORY.name());
            }
            g.setStatus(status);
            dao.set(1L, g);
            return lifeFound;

    }
}
<commit_msg>[valdiation]check human alive to kill him<commit_after>package io.resourcepool.hvsz.service.impl;

import io.resourcepool.hvsz.persistance.dao.DaoMapDb;
import io.resourcepool.hvsz.persistance.models.Game;
import io.resourcepool.hvsz.persistance.models.GameStateEnum;
import io.resourcepool.hvsz.persistance.models.GameStatus;
import io.resourcepool.hvsz.persistance.models.Life;
import io.resourcepool.hvsz.service.ZombieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ZombieServiceImpl implements ZombieService {
    @Autowired
    private DaoMapDb dao;

    @Override
    public boolean kill(String lifeToken) {
        Game g = dao.get(1L);

        GameStatus status = g.getStatus();

            Boolean lifeFound = false;
            for (Life l : status.getLives()) {
                if (l.getToken().toString().equals(lifeToken) && l.isAlive()) {
                    l.setAlive(false);
                    lifeFound = true;
                    //Decrement nbHumaneAlive in game status
                    status.setNbHumanAlive(status.getNbHumanAlive() - 1);
                }
            }
            if (status.getNbHumanAlive() + status.getNbLifeLeft() <= 0) {
                status.setGameState(GameStateEnum.ZOMBIE_VICTORY.name());
            }
            g.setStatus(status);
            dao.set(1L, g);
            return lifeFound;

    }
}

{'fraction_non_alphanumeric': 0.1021261763680725, 'fraction_numerical': 0.0027884280237016382, 'mean_word_length': 2.4453781512605044, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5046784', 'n_tokens_mistral': 888, 'n_tokens_neox': 864, 'n_words': 142}