aimacode / aima-javascript

Javascript visualization of algorithms from Russell And Norvig's "Artificial Intelligence - A Modern Approach"
http://aimacode.github.io/aima-javascript/
MIT License
541 stars 219 forks source link

Ch 5 - Added Minimax and Alpha Beta visualizations #128

Closed ghost closed 6 years ago

redblobgames commented 6 years ago

This is pretty cool — I like how I can use the slider to rewind.

Minor readability suggestions: black text on red is harder to read than white text on red. It might be useful to use dark/light as a way to show which nodes have been evaluated. Instead of black-on-red vs black-on-orange, maybe white-on-red vs black-on-orange.

It might be nice to show which of the child nodes was chosen as the min/max at each level, either by highlighting that node, or by making the line between them thicker.

For Alpha-Beta pruning, I think it would help to show the current pruning condition. For example when evaluating the minimize nodes, you're pruning the rest once you find a node < 6, so you could put something like "prune if < 6" somewhere.

ghost commented 6 years ago

Thanks for the feedback. I worked on what you suggested, and for the Alpha-Beta pruning I tried displaying it in the same notation as the book.

redblobgames commented 6 years ago

Looks cool. Minor suggestions:

ghost commented 6 years ago

I choose to leave the animation auto-playing, but added a jquery function to detect when the animation scrolls into view before starting it.

I also worked with the colors some more. I choose a gradient of colors to show the state of the node from untouched->processing->finished. This also helps the text stay readable.

Thanks, and let me know what you think.

redblobgames commented 6 years ago

This looks nice! :)