<commit_before>package brownshome.scriptwars.server.game.tanks;

import java.nio.ByteBuffer;
import java.util.Collection;

import brownshome.scriptwars.server.connection.UDPConnectionHandler;
import brownshome.scriptwars.server.game.*;

/* Each tick shots are moved x spaces. Then tanks shoot. Then tanks move
 
 *^ -> dead
  
 *  -> survive
  ^
 
 > < -> no movement
 
  v
 *  -> survive
  ^
  
  >> -> back tank shoots 
  
 */

public class TankGame extends Game {
	World world;
	
	public TankGame(boolean[][] map, GameType type) throws OutOfIDsException {
		super(new UDPConnectionHandler(), new DisplayHandler(), type);
		
		this.world = new World(map, this);
	}
	
	public TankGame(GameType type) throws OutOfIDsException {
		this(generateMap(15), type);
	}
	
	private static boolean[][] generateMap(int size) {
		boolean[][] map = new boolean[size][size];
		
		for(int i = 0; i < size; i++) {
			map[0][i] = true;
			map[i][0] = true;
			map[size - 1][i] = true;
			map[i][size - 1] = true;
		}
		
		return map;
	}

	@Override
	public boolean hasPerPlayerData() {
		return true;
	}

	@Override
	public int getMaximumPlayers() {
		return 8;
	}

	@Override
	public int getTickRate() {
		return 50;
	}

	@Override
	public void tick() {
		world.rollBackTanks();
		world.moveShots();
		world.fireTanks();
	}

	@Override
	public int getDataSize() {
		//bytes + worldsize + bulletData
		return 7 + getMaximumPlayers() * 2 + world.getDataSize() + Math.max(world.getWidth(), world.getHeight()) * getMaximumPlayers() * 3;
	}

	/**
	 * 
	 * byte: 0/1 alive or dead
	 * byte: x
	 * byte: y<commit_msg>Revert accidental tick rate change<commit_after>package brownshome.scriptwars.server.game.tanks;

import java.nio.ByteBuffer;
import java.util.Collection;

import brownshome.scriptwars.server.connection.UDPConnectionHandler;
import brownshome.scriptwars.server.game.*;

/* Each tick shots are moved x spaces. Then tanks shoot. Then tanks move
 
 *^ -> dead
  
 *  -> survive
  ^
 
 > < -> no movement
 
  v
 *  -> survive
  ^
  
  >> -> back tank shoots 
  
 */

public class TankGame extends Game {
	World world;
	
	public TankGame(boolean[][] map, GameType type) throws OutOfIDsException {
		super(new UDPConnectionHandler(), new DisplayHandler(), type);
		
		this.world = new World(map, this);
	}
	
	public TankGame(GameType type) throws OutOfIDsException {
		this(generateMap(15), type);
	}
	
	private static boolean[][] generateMap(int size) {
		boolean[][] map = new boolean[size][size];
		
		for(int i = 0; i < size; i++) {
			map[0][i] = true;
			map[i][0] = true;
			map[size - 1][i] = true;
			map[i][size - 1] = true;
		}
		
		return map;
	}

	@Override
	public boolean hasPerPlayerData() {
		return true;
	}

	@Override
	public int getMaximumPlayers() {
		return 8;
	}

	@Override
	public int getTickRate() {
		return 250;
	}

	@Override
	public void tick() {
		world.rollBackTanks();
		world.moveShots();
		world.fireTanks();
	}

	@Override
	public int getDataSize() {
		//bytes + worldsize + bulletData
		return 7 + getMaximumPlayers() * 2 + world.getDataSize() + Math.max(world.getWidth(), world.getHeight()) * getMaximumPlayers() * 3;
	}

	/**
	 * 
	 * byte: 0/1 alive or dead
	 * byte: x
	 * byte: y
{'fraction_non_alphanumeric': 0.13769470404984424, 'fraction_numerical': 0.009657320872274144, 'mean_word_length': 3.3806275579809, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '2558941', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1072, 'n_words': 281}