<commit_before>//package spaceinvaders;

import info.gridworld.actor.Actor;
import info.gridworld.grid.Grid;
import info.gridworld.grid.Location;

public class Shot extends Actor {
    public Shot(int direction) {
        setDirection(direction);
    }

    public void act() {
        Grid<Actor> grid = getGrid();
        if(grid == null)
            return;

        Location move = getLocation().getAdjacentLocation(getDirection());
        if(!grid.isValid(move)) {
            return;
        }
        
        if(grid.get(move) instanceof Wall)
        {
            Wall w = (Wall)grid.get(move);
            w.reduceStrength();
        }
        
        if(grid.get(move) != null) {
            grid.get(move).removeSelfFromGrid();
            removeSelfFromGrid();
        }
        else {<commit_msg>Fixed Shot so that it would actually remove itself when it hit a Wall.<commit_after>//package spaceinvaders;

import info.gridworld.actor.Actor;
import info.gridworld.grid.Grid;
import info.gridworld.grid.Location;

public class Shot extends Actor {
    public Shot(int direction) {
        setDirection(direction);
    }

    public void act() {
        Grid<Actor> grid = getGrid();
        if(grid == null)
            return;

        Location move = getLocation().getAdjacentLocation(getDirection());
        if(!grid.isValid(move)) {
            return;
        }
        
        if(grid.get(move) instanceof Wall) {
            Wall w = (Wall)grid.get(move);
            w.reduceStrength();
            removeSelfFromGrid();
        }
        else if(grid.get(move) != null) {
            grid.get(move).removeSelfFromGrid();
            removeSelfFromGrid();
        }
        else {
{'fraction_non_alphanumeric': 0.11495601173020528, 'fraction_numerical': 0.0, 'mean_word_length': 1.9929824561403509, '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': '2322899', 'n_tokens_mistral': 483, 'n_tokens_neox': 471, 'n_words': 101}