Matteo Ferla has written a python 5E D&D encounter simulator that I have been meaning to get to for some time. Too many real life models to deal with until now.
https://github.com/matteoferla/DnD-battler
He also has an online version here:- https://dnd.matteoferla.com/
http://squidonius.blogspot.com/