<commit_before>let stage;
let playerScore, completeRate, missCombo, perfectCombo, goodCombo;
// let GM = new GameManager('Circle.js');
let hitPadList = [];
// let hitPadUp, hitPadDown, hitPadLeft, hitPadRight;
let circleWay = [];
let circleUp, circleDown, circleLeft, circleRight;
let circleRadius = 50, hitPadRadius = 60;
let heldKeys = {};
let center = { 'x' : window.innerWidth/2, 'y' : window.innerHeight/2};
let interval = 1000;
let queue = [];


var song = [];
var worker = new Worker('worker.js');
var songSelected = 0;
var songContent;
var MainView = new createjs.Container();

var totalHit = 0;

//Final score page
var finalScoreText;
var finalScoreValue;
var completeRateText;
var completeRateValue;
var playAgainButton;
var FinalView = new createjs.Container();

//Start page
var bg;
var start_button;
var title;
var maker;
var TitleView = new createjs.Container();

//Select page
var rank;
var rank_name;
var rank_list;
var SelectView = new createjs.Container();



function readTextFile(file) {
	var rawFile = new XMLHttpRequest();
	rawFile.open("GET", file, false);
	rawFile.onreadystatechange = function ()
	{
		if(rawFile.readyState === 4)
		{
			if(rawFile.status === 200 || rawFile.status == 0)
			{
				var allText = rawFile.responseText;
				songContent = allText.split("\n");
			}
		}
	}
	rawFile.send(null);
}

setInterval("checkQueue()", 100);
function checkQueue() {
	console.log("QQQQQQQWQWQWQWQ");
	for (let i = 0 ; i < queue.length ; i++) {
		if ( checkEdge(queue[i]) ) {
			stage.removeChild(queue[i]);
			queue.shift();
		}
	}
}

worker.onmessage = function(e) {

	if( e.data == "end" ) {
		createjs.Sound.stop();
		stage.removeChild(MainView);
		addFinalScoreView();
	}
	else {

		let tmp = 0 , node = 0;
		switch(e.data) {
		case "0":
			console.log("up");
			// stage.removeChild(ptr);
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Crimson").drawCircle(0, 0, 50);
			tmp.x = center.x;
			tmp.y = center.y;console.log(window.innerHeight/2);console.log("@@@@");
			createjs.Tween.get(tmp).to({y: center.y - window.innerHeight/2 - 100}, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:1};
			queue.push(node);
			// stage.removeChild(circleUp);
			// circleUp = null;
			// circleUp = new createjs.Shape();
			// circleUp.graphics.beginFill("Crimson").drawCircle(0, 0, 50);
			// circleUp.x = center.x;
			// circleUp.y = center.y;
			// createjs.Tween.get(circleUp).to({y: -100}, interval);
			// stage.addChild(circleUp);
			break;
		case "1":
			console.log("down");
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Yellow").drawCircle(0, 0, 50);
			tmp.x = center.x;
			tmp.y = center.y;
			createjs.Tween.get(tmp).to({y: center.y + window.innerHeight/2 + 100 }, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:3};
			queue.push(node);

			break;
		case "2":
			console.log("left");
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Green").drawCircle(0, 0, 50);
			tmp.x = center.x;
			tmp.y = center.y;
			createjs.Tween.get(tmp).to({x: center.x - window.innerWidth/2 - 100}, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:0};
			queue.push(node);
			break;
		case "3":
			console.log("right");
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Blue").drawCircle(0, 0, 50);
			tmp.x = center.x;
			tmp.y = center.y;
			createjs.Tween.get(tmp).to({x: center.x + window.innerWidth/2 + 100}, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:2};
			queue.push(node);
			break;
		}

	}
}

function checkEdge(node) {
	if ( node == undefined ){
		return false;
	}
	let mode = node.mode;
	let flg = false;
	switch (mode) {
		case 0:
			if ( node.circle.x < 0 ) {
				return true;
			}
			break;
		case 1:
			if ( node.circle.y < 0 ) {
				return true;
			}
			break;
		case 2:<commit_msg>change circle alpha<commit_after>let stage;
let playerScore, completeRate, missCombo, perfectCombo, goodCombo;
// let GM = new GameManager('Circle.js');
let hitPadList = [];
// let hitPadUp, hitPadDown, hitPadLeft, hitPadRight;
let circleWay = [];
let circleUp, circleDown, circleLeft, circleRight;
let circleRadius = 50, hitPadRadius = 60;
let heldKeys = {};
let center = { 'x' : window.innerWidth/2, 'y' : window.innerHeight/2};
let interval = 1000;
let queue = [];


var song = [];
var worker = new Worker('worker.js');
var songSelected = 0;
var songContent;
var MainView = new createjs.Container();

var totalHit = 0;

//Final score page
var finalScoreText;
var finalScoreValue;
var completeRateText;
var completeRateValue;
var playAgainButton;
var FinalView = new createjs.Container();

//Start page
var bg;
var start_button;
var title;
var maker;
var TitleView = new createjs.Container();

//Select page
var rank;
var rank_name;
var rank_list;
var SelectView = new createjs.Container();



function readTextFile(file) {
	var rawFile = new XMLHttpRequest();
	rawFile.open("GET", file, false);
	rawFile.onreadystatechange = function ()
	{
		if(rawFile.readyState === 4)
		{
			if(rawFile.status === 200 || rawFile.status == 0)
			{
				var allText = rawFile.responseText;
				songContent = allText.split("\n");
			}
		}
	}
	rawFile.send(null);
}

setInterval("checkQueue()", 100);
function checkQueue() {
	console.log("QQQQQQQWQWQWQWQ");
	for (let i = 0 ; i < queue.length ; i++) {
		if ( checkEdge(queue[i]) ) {
			stage.removeChild(queue[i]);
			queue.shift();
		}
	}
}

worker.onmessage = function(e) {

	if( e.data == "end" ) {
		createjs.Sound.stop();
		stage.removeChild(MainView);
		addFinalScoreView();
	}
	else {

		let tmp = 0 , node = 0;
		switch(e.data) {
		case "0":
			console.log("up");
			// stage.removeChild(ptr);
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Crimson").drawCircle(0, 0, 50);
			tmp.alpha=0.5;
			tmp.x = center.x;
			tmp.y = center.y;console.log(window.innerHeight/2);console.log("@@@@");
			createjs.Tween.get(tmp).to({y: center.y - window.innerHeight/2 - 100}, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:1};
			queue.push(node);
			// stage.removeChild(circleUp);
			// circleUp = null;
			// circleUp = new createjs.Shape();
			// circleUp.graphics.beginFill("Crimson").drawCircle(0, 0, 50);
			// circleUp.x = center.x;
			// circleUp.y = center.y;
			// createjs.Tween.get(circleUp).to({y: -100}, interval);
			// stage.addChild(circleUp);
			break;
		case "1":
			console.log("down");
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Yellow").drawCircle(0, 0, 50);
			tmp.alpha=0.5;
			tmp.x = center.x;
			tmp.y = center.y;
			createjs.Tween.get(tmp).to({y: center.y + window.innerHeight/2 + 100 }, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:3};
			queue.push(node);

			break;
		case "2":
			console.log("left");
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Green").drawCircle(0, 0, 50);
			tmp.alpha=0.5;
			tmp.x = center.x;
			tmp.y = center.y;
			createjs.Tween.get(tmp).to({x: center.x - window.innerWidth/2 - 100}, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:0};
			queue.push(node);
			break;
		case "3":
			console.log("right");
			tmp = new createjs.Shape();
			tmp.graphics.beginFill("Blue").drawCircle(0, 0, 50);
			tmp.alpha=0.5;
			tmp.x = center.x;
			tmp.y = center.y;
			createjs.Tween.get(tmp).to({x: center.x + window.innerWidth/2 + 100}, interval);
			stage.addChild(tmp);
			node = { circle: tmp, mode:2};
			queue.push(node);
			break;
		}

	}
}

function checkEdge(node) {
	if ( node == undefined ){
		return false;
	}
	let mode = node.mode;
	let flg = false;
	switch (mode) {
		case 0:
			if ( node.circle.x < 0 ) {
				return true;
			}
			break;
		case 1:
			if ( node.circle.y < 0 ) {
				return true;
			}
			break;
		case 2:
{'fraction_non_alphanumeric': 0.17180616740088106, 'fraction_numerical': 0.020730759264058048, 'mean_word_length': 3.418431597023469, 'pattern_counts': {'":': 8, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '269491', 'n_tokens_mistral': 3277, 'n_tokens_neox': 2822, 'n_words': 625}