aimacode / aima-python

Python implementation of algorithms from Russell And Norvig's "Artificial Intelligence - A Modern Approach"
MIT License
7.8k stars 3.65k forks source link

Tkinter Applications #659

Open antmarakis opened 6 years ago

antmarakis commented 6 years ago

@apb7 made a tic-tac-toe game using tkinter and it was really cool. I would love to see that idea expanded to more algorithms. The only additional requirement is python3-tk, and the new scripts can be added to a separate folder to keep the main directory as uncluttered as possible.

@norvig, what do you think? I personally feel this is a nice addition to the notebooks, especially since it gives us more freedom. (there is also the possibility of adding tkinter code to notebooks and executing it from there)

apb7 commented 6 years ago

@MrDupin: I'll be implementing other algorithms as well. And as @Chipe1 suggested, an additional side panel to illustrate the working of the respective algorithm can also be added. The directory structure: A separate gui folder to place all Tkinter files.

apb7 commented 6 years ago

@MrDupin: Sorry for catching up so late! Shall I make a PR for the tic-tac-toe game? Also which other algorithms shall I expand this idea to now?

antmarakis commented 6 years ago

No problem. Yes, a PR sounds fine. I suggest you make a PR for the tic-tac-toe, and if it gets accepted you can work on other stuff.

For example, the search algorithms can be implemented in a guy. The nodes can be some random boxes, and with a 'Next' button the next move of the algorithm is shown, maybe by using a color scheme.

Apart from that, you can look at what you can implement from the notebooks into a visual way.

apb7 commented 6 years ago

Okay! Thanks, @MrDupin. I'll get to work and keep you posted.

apb7 commented 6 years ago

@MrDupin and @norvig : I have worked out a bit on the GUI for Searching and have pushed the changes in my version of the repository under gui. A map of Romania has been added as depicted in the book and notebook. Various search techniques will be added soon.
Please feel free to suggest any improvements!

antmarakis commented 6 years ago

The map looks good. The frame of the window though is a bit too small. The "Currently Exploring" item on the legend is cut off.

apb7 commented 6 years ago

I'll make the necessary changes tonight. Also, I have plotted the actual coordinates as given in the romania_map due to which the windows frame seems to be small. Therefore I'll chose some other representative coordinates for this purpose. Thanks!

apb7 commented 6 years ago

@MrDupin and @norvig: The following updates have been made:

apb7 commented 6 years ago

@norvig: Thank you for merging the PR!
@norvig and @MrDupin: I will now try to incorporate more search algorithms in the GUI and also fix a few minor problems. Thanks!

apb7 commented 6 years ago

@norvig and @MrDupin: Breadth-First Search has been added. Also, the window geometry of TIc-Tac-Toe has been improved with a few other minor fixes.
Please feel free to suggest any improvements! Thanks!

apb7 commented 6 years ago

Hello @norvig and @MrDupin! We can add Tkinter GUI for Vacuum Agent problem with multiple options for various agents like Random, Table-Driven, Reflex and Model-Based (as stated in agents.py) in the same GUI. Presently agents.ipynb has visualization for Blind Dog problem. In this way, we'll cover visualizations for both of them. I would love to take this up!
Thanks!

antmarakis commented 6 years ago

Sure, go ahead.

apb7 commented 6 years ago

Hello @norvig and @MrDupin! I have implemented one-dimensional vacuum environment (with 2 tiles) where the user has the option to put dirt or clean a tile, using Tkinter. The GUI currently uses ReflexVacuumAgent and can be expanded to other agents as the GUI Environment is independent of the agent. I have pushed the changes to the gui branch.
Also, I am planning to expand this idea to XYEnvironment, something of this kind:

gs_va

Here, the user will be able to create any thing just by clicking a button on GUI.

Please feel free to suggest any improvements!
Thanks!

antmarakis commented 6 years ago

This looks great, nice work!

When you say the user has the option to put dirt on a tile, do you mean the user can, with a tile-click, turn the tile into 'D'? If yes, can this be expanded to the user creating environments on their own (by also adding walls)? This would be very interesting.

apb7 commented 6 years ago

Yes, the user will be able to change the environment at any point of time by creating walls, dirt or leaving the tiles clean!

antmarakis commented 6 years ago

This is great, nice work!

If you haven't implemented it already, I would suggest making the outer walls read-only, so that the algorithm will not have to check for boundaries.

apb7 commented 6 years ago

Thank you @MrDupin! I will incorporate this suggestion for sure!

apb7 commented 6 years ago

Hello @norvig and @MrDupin! I have pushed the XYEnvironment to the gui branch. The environment is completely dynamic. The user can now create the environment as required by clicking the tiles. I have also created an XYReflexAgentProgram for the two-dimensional environment. This program can be modified further to a more efficient one.
Please feel free to suggest further improvements.
Thanks!