Build tree and visualization
Almost the logic for minmax search, but for a bug.