Ejemplo n.º 1
0
		//
		//Trueを返した場合、中断して十分に低いスコアを返す
		private bool CheckSolidGroup( AnalizeData result, BlockGroup g, bool first, int pos, int sum, ModelBlock empty = null, int emptyCount = 0 ){
			if( g.Counter != AnalizeCounter ){
				g.Reset();
				g.Counter = AnalizeCounter;
			}else if( g.Broken || g.Success )	return false;
			var blocks = g.Blocks;
			
			for( int l = blocks.Count, max = l + 1; pos < l; pos++ ){
				var b = blocks[pos];
				if( b.Number > 0 )				sum += b.Number;
				else if( emptyCount++ == 0 )	empty = b;
			}
			
			if( sum > Sum - emptyCount ){
				g.Success = true;
				//if( first ) result.Score += SolidScore * g.FamilyNum;
				return false;
			}else{
				if( emptyCount == 0 ){
					if( sum == Sum ){
						if( AddBrokenGroup( result, g ) ) 	return true;
						return false;
					}else if( sum > Sum ){
						g.Success = true;
						return false;
						//if( first ) result.Score += SolidScore * g.FamilyNum;
					}
				}else if( emptyCount == 1 ){
					int bc 	= empty.LifeNum;
					int c 	= empty.KillAt( Sum - sum );
					if( bc != c ){
						if( c == 0 ){
							if( AddBrokenBlock( result, empty ) ) return true;
							return false;
						}else{
							Changed = true;
							if( c == 1 ){
								empty.Number = Array.IndexOf( empty.DeadList, false ) + 1;
								
								sum 	+= empty.Number;
								empty 	= null;
								emptyCount--;
								
								if( sum > Sum ){
									g.Success = true;
									return false;
								}
							}
						}
					}
				}
			}
			
			var children = g.Children;
			if( children != null )
				for( int i = 0, l = children.Count; i < l; i++ )
					if( CheckSolidGroup( result, children[i], first, pos, sum, empty, emptyCount ) ) return true;
			
			return false;
		}