flood-fill

How do I find path using 2d array maze in java

我只是一个虾纸丫 提交于 2021-01-28 09:44:48
问题 B B B B B B B B O B B B S O B B O O B B B B X B B Here, S = Start Point(2,2) B = Block O = Open X = Exit I want to make a maze that will check north, west, east and south. if X is around it will return the program. If not, then check for any 'O' around the start point and pass the new start point recursively. It there is no way to go and 'X' is not found it will go back to the original start point(2,2) and check west, east and south. after the program, i got: B B B B B B B B + B B B + + B B O

How do I find path using 2d array maze in java

↘锁芯ラ 提交于 2021-01-28 09:31:06
问题 B B B B B B B B O B B B S O B B O O B B B B X B B Here, S = Start Point(2,2) B = Block O = Open X = Exit I want to make a maze that will check north, west, east and south. if X is around it will return the program. If not, then check for any 'O' around the start point and pass the new start point recursively. It there is no way to go and 'X' is not found it will go back to the original start point(2,2) and check west, east and south. after the program, i got: B B B B B B B B + B B B + + B B O

Python: floodfill algorithm for minesweeper

梦想的初衷 提交于 2020-01-16 18:38:11
问题 I'm writing a minesweeper game in python, and am currently trying to implement a floodfill algorithm. This is what I've written: def floodfill(CURRENT_BOARD, row, col): count = count_mines(row, col) if count in POSSIBLE_MINE_NUMBERS: CURRENT_BOARD[row][col] = str(count) + ' ' else: if CURRENT_BOARD[row][col] == 'P ': CURRENT_BOARD[row][col] = 'P ' if row > 0: floodfill(CURRENT_BOARD, row - 1, col) if row < len(BOARD[row]) - 1: floodfill(CURRENT_BOARD, row + 1, col) if col > 0: floodfill

C++ algorithm for flood filling a binary image

青春壹個敷衍的年華 提交于 2020-01-15 11:08:29
问题 I am trying to simulate a matlab function "imfill" for flood filling a binary image (2D matrix of 1's and zeros). I want to specify a starting point in the matrix, and flood fill like a 4 connected version of imfill would do. Does this already exist out there somewhere in the C++ world? If not, what would be the most efficient way to implement this? 回答1: If your images are just 2D arrays of 1s and 0s, then I don't think you need an actual graphics library. When I've filled in simple grids in

C++ algorithm for flood filling a binary image

我是研究僧i 提交于 2020-01-15 11:04:11
问题 I am trying to simulate a matlab function "imfill" for flood filling a binary image (2D matrix of 1's and zeros). I want to specify a starting point in the matrix, and flood fill like a 4 connected version of imfill would do. Does this already exist out there somewhere in the C++ world? If not, what would be the most efficient way to implement this? 回答1: If your images are just 2D arrays of 1s and 0s, then I don't think you need an actual graphics library. When I've filled in simple grids in

Floodfill part of an Image

流过昼夜 提交于 2020-01-14 09:07:14
问题 I have an image like bellow i want to make the image become like I already make the code, like this : var Tx,Ty, R,G,B,A, posX, posY : integer; begin posX :=-1; posY := -1; for Ty:= 0 to Image1.Height-1 do begin for Tx:= 0 to Image1.Width-1 do begin R:= GetRValue(image1.Canvas.Pixels[Tx, Ty]); G:= GetGValue(image1.Canvas.Pixels[Tx, Ty]); B:= GetBValue(image1.Canvas.Pixels[Tx, Ty]); A:= (R + G + B) Div 3; if (A > 50) then begin Image1.Canvas.Pixels[Tx,Ty] := rgb(255,255,255); end else begin

Flood Fill in Python

China☆狼群 提交于 2020-01-10 04:26:45
问题 I'm complitely new to Flood Fill algorithm. I checked it out from Wikipedia (http://en.wikipedia.org/wiki/Flood_fill). But didn't become that much wiser. I'm trying to use it in following situation. I have a matrix: matrix = [["a", "a", "b", "a", "a", "b"], ["a", "b", "b", "a", "b", "b"], ["b", "a", "b", "a", "a", "b"], ["b", "a", "b", "a", "b", "b"], ["a", "a", "b", "a", "a", "a"], ["a", "b", "b", "a", "a", "b"]] Then I let user to decide one point from matrix. If in that given point is "b"