<commit_before>package simpleslickgame;

import java.util.ArrayList;
import java.util.Iterator;


public class TVGrid{
	
	private TVBlock[][] gameboard;
	private ArrayList<Integer[]> currentShape;
	
	public TVGrid()
	{
		gameboard = new TVBlock[22][10];
		currentShape = new ArrayList<Integer[]>();
	}
	
	public void addShapetoTop(TVShape shape){
		
		int[] botRightBlock = shape.findBottomRight(shape.blocks);
		int[] botRightCoord = shape.getBottomRightCoord();
		TVBlock[][] blocks = shape.getBlocks();
		int i = botRightBlock[0];
		int j = botRightBlock[1];
		currentShape.clear();
		for(int r = botRightCoord[0]; r >= botRightCoord[0] - 4; r--){
			for(int c = botRightCoord[1]; c >= botRightCoord[1] - 4; c--){
				if(i >= 0 && j >= 0 && blocks[i][j] != null){
					gameboard[r][c] = blocks[i][j];
					currentShape.add(new Integer[]{r, c});
				}
				System.out.println("i: " + i + " j: " + j);
				j--;
			}
			i--;
			j = botRightBlock[1];
		}
		displayBlock();
	}
	
	public void updateCurrentShape(TVShape shape){
		for(Iterator<Integer[]> it = currentShape.iterator(); it.hasNext();){
			Integer[] cur = it.next();
			gameboard[cur[0]][cur[1]] = null;
		}
		int[] botRightBlock = shape.findBottomRight(shape.blocks);
		int[] botRightCoord = shape.getBottomRightCoord();
		TVBlock[][] blocks = shape.getBlocks();
		int i = botRightBlock[0];
		int j = botRightBlock[1];
		currentShape.clear();
		for(int r = botRightCoord[0]; r >= botRightCoord[0] - 4; r--){
			for(int c = botRightCoord[1]; c >= botRightCoord[1] - 4; c--){
				if(i >= 0 && j >= 0 && blocks[i][j] != null){
					gameboard[r][c] = blocks[i][j];
					currentShape.add(new Integer[]{r, c});
				}
				System.out.println("i: " + i + " j: " + j);
				j--;
			}
			i--;
			j = botRightBlock[1];
		}
		displayBlock();
	}
	
	public void removeBlock(){}
	
	public void moveRowDown(){}
	
	public void moveBlockDown(TVBlock tvblock){}
	
	public void isCollided(TVShape shape){}
	
	public void drawBlocks(){
		<commit_msg>Some grid functionality added<commit_after>package simpleslickgame;

import java.util.ArrayList;
import java.util.Iterator;


public class TVGrid{
	
	private TVBlock[][] gameboard;
	private ArrayList<Integer[]> currentShape;
	
	public TVGrid()
	{
		gameboard = new TVBlock[22][10];
		currentShape = new ArrayList<Integer[]>();
	}
	
	public void addShapetoTop(TVShape shape){
		
		int[] botRightBlock = shape.findBottomRight(shape.blocks);
		int[] botRightCoord = shape.getBottomRightCoord();
		TVBlock[][] blocks = shape.getBlocks();
		int i = botRightBlock[0];
		int j = botRightBlock[1];
		currentShape.clear();
		for(int r = botRightCoord[0]; r >= botRightCoord[0] - 4; r--){
			for(int c = botRightCoord[1]; c >= botRightCoord[1] - 4; c--){
				if(i >= 0 && j >= 0 && blocks[i][j] != null){
					gameboard[r][c] = blocks[i][j];
					currentShape.add(new Integer[]{r, c});
				}
				System.out.println("i: " + i + " j: " + j);
				j--;
			}
			i--;
			j = botRightBlock[1];
		}
		displayBlock();
	}
	
	public void updateCurrentShape(TVShape shape){
		for(Iterator<Integer[]> it = currentShape.iterator(); it.hasNext();){
			Integer[] cur = it.next();
			gameboard[cur[0]][cur[1]] = null;
		}
		int[] botRightBlock = shape.findBottomRight(shape.blocks);
		int[] botRightCoord = shape.getBottomRightCoord();
		TVBlock[][] blocks = shape.getBlocks();
		int i = botRightBlock[0];
		int j = botRightBlock[1];
		currentShape.clear();
		for(int r = botRightCoord[0]; r >= botRightCoord[0] - 4; r--){
			for(int c = botRightCoord[1]; c >= botRightCoord[1] - 4; c--){
				if(i >= 0 && j >= 0 && blocks[i][j] != null){
					gameboard[r][c] = blocks[i][j];
					currentShape.add(new Integer[]{r, c});
				}
				System.out.println("i: " + i + " j: " + j);
				j--;
			}
			i--;
			j = botRightBlock[1];
		}
		displayBlock();
	}
	
	public void removeBlock(int row, int col){
		gameboard[row][col] = null;
	}
	
	public void moveRowDown(){}
	
	public void moveBlockDown(TVBlock block){
		
	}
	
	public void isCollided(TVShape shape){}
	
	public void drawBlocks(){
		
{'fraction_non_alphanumeric': 0.18188567186340016, 'fraction_numerical': 0.013857955951497154, 'mean_word_length': 3.598407281001138, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, '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': '4531048', 'n_tokens_mistral': 1655, 'n_tokens_neox': 1420, 'n_words': 322}