diff --git a/Meteo_Engine.jar b/Meteo_Engine.jar index 77cac55..1e43711 100644 Binary files a/Meteo_Engine.jar and b/Meteo_Engine.jar differ diff --git a/src/sig/BlockClump.java b/src/sig/BlockClump.java index f845ab2..259d361 100644 --- a/src/sig/BlockClump.java +++ b/src/sig/BlockClump.java @@ -2,8 +2,8 @@ package sig; import java.awt.Graphics; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; import java.awt.Color; public class BlockClump { @@ -77,6 +77,12 @@ public class BlockClump { public List getBlocks() { return blocks; } + public List getSortedBlocksOnRow(int row) { + return getBlocks().stream().filter((block)->block.y==row).sorted((b1,b2)->b1.x-b2.x).collect(Collectors.toList()); + } + public List getSortedBlocksOnCol(int col) { + return getBlocks().stream().filter((block)->block.x==col).sorted((b1,b2)->b1.y-b2.y).collect(Collectors.toList()); + } private void updateBlockCollisionRangeWithBlock(Block b) { if (collisionColumnRanges[b.x][0]==-1||collisionColumnRanges[b.x][0]>b.y) { collisionColumnRanges[b.x][0]=b.y; diff --git a/src/sig/Board.java b/src/sig/Board.java index 9757332..e20b23a 100644 --- a/src/sig/Board.java +++ b/src/sig/Board.java @@ -112,13 +112,10 @@ public class Board { //Start from one block and work our way across, seeing if we can make a match of 3 or more. Go to the next row, repeat. Then do the columns. Once all blocks marked for ignition, ignite them and send them. //Lowest block is used as the block clump starting point. for (int y=0;y bl = blocks.getBlocks().stream().filter((block)->block.x==xx&&block.y==yy).collect(Collectors.toList()); - if (bl.size()>0) { - //System.out.println("Found a block at ("+x+","+y+")"); - } - } + System.out.println(blocks.getSortedBlocksOnRow(y)); + } + for (int x=0;x