A.I

Week 6

Today we started A.I week by asking the question; "What is Intelligence?" We basically agreed that intelligence is not as easy to define as we might of thought because there are so many possibilities. In my opinion an intelligent being knows what is right from wrong, they know how to respond in multiple manners, and they can solve basic problems. We also agreed that intelligence is never going to be perfect and you cant be born with it because everyone has to learn something first before becoming intelligent. One man named Howard Gardner theorized that Intelligence requires 8 main components: linguistic, logical-mathematical, musical, bodily-kinesthetic, spatial, interpersonal, intrapersonal, and naturalist.



Another person that we learned about is a guy named Alan Turing, whom I think I mentioned earlier in my website. What is interesting is that he was a major genius in the mathematical and computer world because he was an outsider in society he decided to take his life. But in the computer world he was a genius, he was a major resource in cracking codes during WWII. One of his main projects was deciphering the Enigma Code which gave the allies the Upperhand in WWII.



Chat Bots

Before lunch we played with some chat bots and I got to say, I had some pretty interesting conversations.



Above is a picture of a chat bot called Mitsuku which is actually very well designed. I realized that most answers that it sent had a very wide range of interpretations but also seemed very realistic. And another good quality is that it remembers stuff that was already said before so the conversation seems much more natural. I noticed that another chat bot called cleverbot often forgot the topic and would thus say random stuff.



Tuesday

Today we continued working on a chat bot of our own. I think it was pretty fun because I got to learn and use a lot more new codes and loops in Python and in was interesting having a conversation with something that I made. What I wish I could of done more is have more user input so that the person is talking to the robot not the robot talking to the user, but for now it is pretty good.



As you can see the A.I did ask a question multiple times, and that is because of making different encounters with different questions, I decided to make a list of questions and the A.I choose a random one to ask. And it also gave some of the same responses and that is because I made a list for that also.





On Wednesday we again worked on the chat bots and most of the time was independent work. Personally I made my third chat bot that didn't ask the questions but answered user inputed questions. Once I found out how to make it so that the user question will always be seen as lower case even if the asked in a capitalized font, I was on a coding roll. I made it so that there could be different responses to similar questions and I mostly worked so that the answers were very broad so that the A.I could answer easier.


Week 7

For the first day of week 7, we jumped right back into AI. Today's challenged like always sounded simple, however as always it proved to be a bi challenging. Our job for today was to create a python game that we could interact with and it could be easily changed. One of the main tasks was to have each part of the game made into a function. Unfortunately I didn't know so I made the whole thing one giant script. It still works, however if it didn't work, then it takes a ridiculously long and painful time to try to find the problem and then even more to fix it so that it all works. My code looks a bit like this:



Some of the main components of my code is the "if" statement where it asks the question and loops around so you have multiple tries, and my "while true" statement which I named lose because if you win, lose is false but if you do lose it stays true and has a different ending.



Tuesday April 21

Today we again worked on python to make a pygame. Today's game was a lot harder even though its such a simple game to play. Our task was to make Hangman. In the beginning, my project was moving very smoothly, however it became challenging when I got to the human input function and checking section. It was really hard because I didnt get how to look at the human input and then have the computer compare it with the chosen word. From there everything started to fall apart. Yet I did learn a lot from this project. I learned that when it comes to long codes, the best way to write them is through multiple functions. I believe this because in the end, all those functions can be copied for other projects and when it comes to testing your code, its way easier to test a certain function than the whole program. Heres some pictures of my code:

Wednesday April 22

Today we continued working on the Hangman game. What really helped me was when we went over the code in class, however I still did not get my Hangman to work. Some of the problems that I think I made is that I really overcomplicated things by making certain functions include things that weren't necessary and sometimes I made a function that wasn't necessary at all. However I did learn some new stuff like how we learned how to get websites into Python. We did this to add a longer word choice dictionary. Even though this got lots of words I did have to change some parts because before I had a very small word dictionary and because of this I made each word choice have a different intro, but because I now had a lot of words, I just scraped it and the code worked a lot more smoothly.



Thursday April 23

Today we started right on TicTacToe, and immediately I was very doubtful in this project because from earlier this week it has proven to be a challenge. But contrary to my doubts, today actually moved smoothly. The last couple of times I would try to work on the whole project at ounce, but today I tried something different. Today I worked on each function according to what I knew, so I started with a greeting and then went to the board and so on and so forth. Then by brunch I had a pretty good program and all I needed was help on how to switch players, change the look of the board, and how to check the winner which the whole class got help on. Some of the things that I learned today is that it is very important to add comments. During hangman, I got really confused because I used some names that were related to other functions, but this time I made a comment to what this function did and where it would go in the loop.



Friday April 24

Friday was just a wrap up day where we finished our tic tac toes. My end product was definitely better than I expected because I totally thought that it would take forever to type a working code. But this whole week I continued to be reminded to use individual functions and this proved very helpful especially when we started to make a AI for tic tac toe. At first we just made an AI that choose randomly with no strategy and for the most part it did work, but at times it made such poor moves that you could tell that it had no thought patterns. This where the real AI comes in. This requires a lot of thinking for the programmer because not only do you have to write something in another language, but you really have to dig deep to find out how to really use a strategy. When you play hangman you look for ways you could win, but you winning is only one part of the game, you need to make sure that the opponent doesn't win either. This is where true intelligence is needed in making choices because you could make a computer do anything, but if it just does it blindly or randomly then nothing will ever get accomplished. Below is some pictures of my AI code that Mr. Farrell showed us.