Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
566 B
7
Indexable
Never
class Tile{
	public int x;
	public int y;
	
	public Tile(int x, int y){
		this.x = x;
		this.y = y;
	}
}

class TileQueue{
	public Tile[] queue = new Tile[1000005];
	public int front, rear;
	
	public TileQueue(){
		this.front = -1;
		this.rear = -1;
	}
	public void reset(){
		this.front = -1;
		this.rear = -1;
	}
	public void enQueue(Tile c){
		rear++;
		queue[rear] = c;
	}
	
	public Tile deQueue(){
		front++;
		return queue[front];
	}
	public boolean isEmpty(){
		if (rear == front){
			return true;
		}
		return false;
	}
}
Leave a Comment