<commit_before>//
// パズル固有スクリプト部 ナンロー版 nanro.js
//
(function(pidlist, classbase){
	if(typeof module==='object' && module.exports){module.exports = [pidlist, classbase];}
	else{ pzpr.classmgr.makeCustom(pidlist, classbase);}
}(
['nanro'], {
//---------------------------------------------------------
// マウス入力系
MouseEvent:{
	mouseinput : function(){
		if(this.puzzle.playmode){
			if(this.mousestart || this.mousemove){
				if     (this.btn==='left') { this.dragnumber_nanro();}
				else if(this.mousemove && this.btn==='right'){ this.inputDot_nanro();}
			}
			else if(this.mouseend && this.notInputted()){
				this.mouseCell = this.board.emptycell;
				this.inputqnum();
			}
		}
		else if(this.puzzle.editmode){
			if(this.mousestart || this.mousemove){ this.inputborder();}
			else if(this.mouseend && this.notInputted()){
				this.mouseCell = this.board.emptycell;
				this.inputqnum();
			}
		}
	},

	dragnumber_nanro : function(){
		var cell = this.getcell();
		if(cell.isnull||cell===this.mouseCell){ return;}
		if(this.mouseCell.isnull){
			this.inputData = cell.getNum();
			if     (this.inputData===-2){ this.inputData=null;}
			else if(this.inputData===-1){
				if     (cell.qsub===1){ this.inputData=-2;}
				else if(cell.qsub===2){ this.inputData=-3;}
			}
			this.mouseCell = cell;
		}
		else if(cell.qnum===-1){
			cell.setNum(this.inputData);
			this.mouseCell = cell;
			cell.draw();
		}
	},
	inputDot_nanro : function(){
		var cell = this.getcell();
		if(cell.isnull || cell===this.mouseCell || cell.isNum()){ return;}
		if(this.inputData===null){ this.inputData = (cell.qsub===2?0:2);}
		if     (this.inputData===2){ cell.setAnum(-1); cell.setQsub(2);}
		else if(this.inputData===0){ cell.setAnum(-1); cell.setQsub(0);}
		this.mouseCell = cell;
		cell.draw();
	}
},

//---------------------------------------------------------
// キーボード入力系
KeyEvent:{
	enablemake : true,
	enableplay : true,

	keyinput : function(ca){
		this.key_view(ca);
	},
	key_view : function(ca){
		if(this.puzzle.playmode){
			var cell = this.cursor.getc();
			if     (ca==='q'||ca==='a'||ca==='z')          { ca='s1';}
			else if(ca==='w'||ca==='s'||ca==='x')          { ca='s2';}
			else if(ca==='e'||ca==='d'||ca==='c'||ca==='-'){ ca=' '; }
			else if(ca==='1' && cell.anum===1)             { ca='s1';}
			else if(ca==='2' && cell.anum===2)             { ca='s2';}
		}
		this.key_inputqnum(ca);
	}
},

//---------------------------------------------------------
// 盤面管理系
Cell:{
	numberWithMB : true,

	maxnum : function(){
		return this.room.clist.length;
	}
},
Board:{
	cols : 8,
	rows : 8,

	hasborder : 1
},

AreaNumberGraph:{
	enabled : true
},
AreaRoomGraph:{
	enabled : true,

	// オーバーライド
	setExtraData : function(component){
		var clist = component.clist = new this.klass.CellList(component.getnodeobjs());
		var nums = [];
		var numkind=0, filled=-1;
		for(var i=0;i<clist.length;i++){
			var num = clist[i].getNum();
			if(num!==-1){
				if(isNaN(nums[num])){ numkind++; filled=num; nums[num]=1;}
				else{ nums[num]++;}
			}
		}
		component.number  = filled;
		component.numcnt  = nums[filled];
		component.numkind = numkind;
	}
},<commit_msg>nanro: Regenerate room number info when numbers are inputted<commit_after>//
// パズル固有スクリプト部 ナンロー版 nanro.js
//
(function(pidlist, classbase){
	if(typeof module==='object' && module.exports){module.exports = [pidlist, classbase];}
	else{ pzpr.classmgr.makeCustom(pidlist, classbase);}
}(
['nanro'], {
//---------------------------------------------------------
// マウス入力系
MouseEvent:{
	mouseinput : function(){
		if(this.puzzle.playmode){
			if(this.mousestart || this.mousemove){
				if     (this.btn==='left') { this.dragnumber_nanro();}
				else if(this.mousemove && this.btn==='right'){ this.inputDot_nanro();}
			}
			else if(this.mouseend && this.notInputted()){
				this.mouseCell = this.board.emptycell;
				this.inputqnum();
			}
		}
		else if(this.puzzle.editmode){
			if(this.mousestart || this.mousemove){ this.inputborder();}
			else if(this.mouseend && this.notInputted()){
				this.mouseCell = this.board.emptycell;
				this.inputqnum();
			}
		}
	},

	dragnumber_nanro : function(){
		var cell = this.getcell();
		if(cell.isnull||cell===this.mouseCell){ return;}
		if(this.mouseCell.isnull){
			this.inputData = cell.getNum();
			if     (this.inputData===-2){ this.inputData=null;}
			else if(this.inputData===-1){
				if     (cell.qsub===1){ this.inputData=-2;}
				else if(cell.qsub===2){ this.inputData=-3;}
			}
			this.mouseCell = cell;
		}
		else if(cell.qnum===-1){
			cell.setNum(this.inputData);
			this.mouseCell = cell;
			cell.draw();
		}
	},
	inputDot_nanro : function(){
		var cell = this.getcell();
		if(cell.isnull || cell===this.mouseCell || cell.isNum()){ return;}
		if(this.inputData===null){ this.inputData = (cell.qsub===2?0:2);}
		if     (this.inputData===2){ cell.setAnum(-1); cell.setQsub(2);}
		else if(this.inputData===0){ cell.setAnum(-1); cell.setQsub(0);}
		this.mouseCell = cell;
		cell.draw();
	}
},

//---------------------------------------------------------
// キーボード入力系
KeyEvent:{
	enablemake : true,
	enableplay : true,

	keyinput : function(ca){
		this.key_view(ca);
	},
	key_view : function(ca){
		if(this.puzzle.playmode){
			var cell = this.cursor.getc();
			if     (ca==='q'||ca==='a'||ca==='z')          { ca='s1';}
			else if(ca==='w'||ca==='s'||ca==='x')          { ca='s2';}
			else if(ca==='e'||ca==='d'||ca==='c'||ca==='-'){ ca=' '; }
			else if(ca==='1' && cell.anum===1)             { ca='s1';}
			else if(ca==='2' && cell.anum===2)             { ca='s2';}
		}
		this.key_inputqnum(ca);
	}
},

//---------------------------------------------------------
// 盤面管理系
Cell:{
	numberWithMB : true,

	maxnum : function(){
		return this.room.clist.length;
	}
},
Board:{
	cols : 8,
	rows : 8,

	hasborder : 1
},

AreaNumberGraph:{
	enabled : true
},
AreaRoomGraph:{
	enabled : true,
	relation : {'cell.qnum':'info', 'cell.anum':'info', 'border.ques':'separator'},

	// オーバーライド
	modifyOtherInfo : function(cell,relation){
		this.setNumOfRoom(cell.room);
	},
	setExtraData : function(component){
		this.common.setExtraData.call(this,component);
		this.setNumOfRoom(component);
	},
	setNumOfRoom : function(component){
		var clist = component.clist;
		var nums = [];
		var numkind=0, filled=-1;
		for(var i=0;i<clist.length;i++){
			var num = clist[i].getNum();
			if(num!==-1){
				if(isNaN(nums[num])){ numkind++; filled=num; nums[num]=1;}
				else{ nums[num]++;}
			}
		}
		component.number  = filled;
		component.numcnt  = nums[filled];
		component.numkind = numkind;
	}
},
{'fraction_non_alphanumeric': 0.25741670470104977, 'fraction_numerical': 0.00973680206907044, 'mean_word_length': 2.896858328393598, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7180674', 'n_tokens_mistral': 2777, 'n_tokens_neox': 2532, 'n_words': 383}