Is there an algorithm for drawing resonance structures?

**Question**


What is an instance of a procedure for writing resonance structures for any given compound's name or structural formula?


I would prefer any of these formats to represent the algorithm:


* [Numbered list](https://www.definitions.net/definition/numbered+list)
* [Flow diagram](https://en.wikipedia.org/wiki/Flow_diagram)
* [Decision tree](https://en.wikipedia.org/wiki/Decision_tree)
* [Pseudocode](https://en.wikipedia.org/wiki/Pseudocode)


Any format that is human-readable and has ordinated the steps is probably okay.


**Purpose**


For myself, I would like to have such an algorithm because I prefer to systematically solve problems. I may also wish to write a computer program to perform this task in the future, so understanding the logic in more detail would help me create the decision tree.


For others that do not understand how to draw resonance structures, I hope the responses to this question are useful for their learning. I've seen a lot of people struggle with this topic.


**Demonstration of Effort**


I have been combing through my organic chemistry textbook (*Organic Chemistry, Seventh Edition, L.G. Wade, Jr., Whitman College, Pearson, Copyright 2010*) for rules to drawing resonance structures.


Here are the general principles I have found:


* Each resonance structure has the property of being a valid Lewis structure
* Electrons can be delocalized
* Nuclei cannot be delocalized (ie don't move them)
* Prefer placing pairs of electrons to instead of single electrons
* Never separate pairs of electrons
* Maximize the number of octets acheived among the atoms that obey the octet rule
* Maximize the number of bonds in the structure
* Prefer to place negative charges on electronegative atoms
* Prefer to produce structures with minimized charge separation
* Prefer structures with a negative formal charge instead of positive formal charge


