diff --git a/Meteo_Engine.jar b/Meteo_Engine.jar index 4b234c4..ee98b0e 100644 Binary files a/Meteo_Engine.jar and b/Meteo_Engine.jar differ diff --git a/src/sig/Block.java b/src/sig/Block.java index c22b409..1fc2a7e 100644 --- a/src/sig/Block.java +++ b/src/sig/Block.java @@ -16,7 +16,7 @@ public class Block{ public Block(int x,int y) { this.x=x; this.y=y; - state = STARTINGSTATES[(int)(Math.random()*STARTINGSTATES.length)]; + state = STARTINGSTATES[(int)(Math.random()*1)]; } @Override public String toString() { diff --git a/src/sig/BlockClump.java b/src/sig/BlockClump.java index a41241f..ed7216b 100644 --- a/src/sig/BlockClump.java +++ b/src/sig/BlockClump.java @@ -49,9 +49,9 @@ public class BlockClump { } public void removeBlock(Block...blocks) { for (Block b : blocks) { - updateBlockCollision(); this.blocks.remove(b); } + updateBlockCollision(); } public void drawBlocks(Graphics g, int originX, int originY, int block_width, int block_height) { for (Block b : blocks) { @@ -95,8 +95,8 @@ public class BlockClump { } if (collisionColumnRanges[b.x][1]==-1||collisionColumnRanges[b.x][1] markedBlocks = new ArrayList(); for (int y=0;y blockList = blocks.getSortedBlocksOnRow(y); - List markedBlocks = FindMatches(blockList,width,true); - int ourY = 0; - if (markedBlocks.size()>0) { //Ignite these blocks. - //Get all blocks above us. We will be taking all of these out of the current block clump and making a new one. - List newClumpList = new ArrayList(); - for (Block b : markedBlocks) { //Get all blocks above this set. - newClumpList.addAll(blocks.getBlocks().stream().filter((block)->block.x==b.x&&block.y>b.y).collect(Collectors.toList())); - b.state = BlockState.IGNITED; - ourY=b.y; - } - newClumpList.addAll(markedBlocks); - BlockClump newClump = new BlockClump(newClumpList,0,blocks.y+ourY*block_height,launch_power,width,120); - blocks.removeBlock(markedBlocks.toArray(new Block[markedBlocks.size()])); - blockClumpAddList.add(newClump); - //System.out.println("Marked: "+markedBlocks); - } + markedBlocks.addAll(FindMatches(blockList,width,true)); } for (int x=0;x blockList = blocks.getSortedBlocksOnCol(x); - List markedBlocks = FindMatches(blockList,blocks.maxBlockHeight,false); - if (markedBlocks.size()>0) { //Ignite these blocks. - System.out.println("Marked: "+markedBlocks); + markedBlocks.addAll(FindMatches(blockList,blocks.maxBlockHeight,false)); + } + if (markedBlocks.size()>0) { + List newClumpBlocks = new ArrayList(); + newClumpBlocks.addAll(markedBlocks); + for (Block b : markedBlocks) { + b.state = BlockState.IGNITED; + //All blocks above marked blocks now join the clump. + newClumpBlocks.addAll(blocks.getSortedBlocksOnCol(b.x).stream().filter((block)->!newClumpBlocks.contains(block)&&block.y>b.y).collect(Collectors.toList())); } + //For now just get rid of them. + blocks.removeBlock(newClumpBlocks.toArray(new Block[newClumpBlocks.size()])); } return false; } @@ -166,6 +161,7 @@ public class Board { } else { if (matches>=3) { markedBlocks.addAll(tempMarkedBlocks); + System.out.println(" Added to Marked blocks: "+tempMarkedBlocks); } matches=1; col=currentBlock.state; @@ -180,6 +176,7 @@ public class Board { } if (matches>=3) { markedBlocks.addAll(tempMarkedBlocks); + System.out.println(" Added to Marked blocks: "+tempMarkedBlocks); } return markedBlocks; }