Skip to content

Redundant Validity Checks in Flood Fill Julia and C Implementations #765

Closed
@lazyprop

Description

@lazyprop

In the Julia and C implementations, the color function checks if the point is inside bounds and if old_val == new_val.
These conditions are already checked in the find_neighbours function. So the points which are passed to color will always satisfy these conditions.The conditions are totally unnecessary.
color can simply be:

def color(canvas, p, new_val):
    canvas[p] = new_val

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions