Skip to content

Update code to handle automated piece matching #1

@ErikOverflow

Description

@ErikOverflow

if (stampColors[tempPixel] != targetColor) //if the pixel is not the target color, move on

If this if check returns true and continues, this means that the pixel that was found is a neighboring pixel. Keeping a dictionary to track all pieces that were neighboring that pixel as they are generated would be a good idea.

Dictionary<int, List<int>> pixelDict = new Dictionary<int, List<int>>();
                    if (stampColors[tempPixel] != targetColor) //if the pixel is not the target color, move on
                    {
                        if(!pixelDict.ContainsKey(tempPixel))
                        {
                            pixelDict.Add(tempPixel, new List<int>());
                        }
                        pixelDict[tempPixel].Add(pieceNum);
                        continue;
                    }
                    if(pixelDict.ContainsKey(tempPixel)
                        //This set all pieces in the list as matches to one another

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions