Text this: A tree structure algorithm for optimal control problems with state constraints