Programming Page

Programming

Home

For the first week of Computer Science we worked on coding with Netlogo and html. The first day we learned everyone's names and were introduced to Netlogo and began to make shapes like squares, stars and we learned of loops that make repetitive coding much easier. We also began to make our websites(which I still struggle at) and I subscribed to the Youtube channel that Mr. Farrell showed us.

The second day we began to make the more complicated shapes like .


In this image I made a Y tree and a Star wheel with netlogo. To do this I used these code codes:


What these codes are composed of is repetitions of earlier codes that made either a Y or a Star.

The third day(Wednesday) we made a turtle colony with net logo. I personally think that this was hecka cool because I didn't control the turtles at all and yet they moved around and ate lechuga randomly. This was because we added multiple codes that made the computer move itself instead of me having to do separate sets of commands. This also allowed the turtles to all have a different path, and no turtle had the same path. But also the colony modelled the path of survival because we gave them an attribute for energy. And energy was gained and lost as the turtle moved, breeded, and ate "grass".




This was possible with a long set of coding that modelled different situations that real turtles face in the wild. Different situations included birth rate, how fast food grew, if some colors had more fitness and could move farther on less energy, etc.


Because my colony was completely randomized and had to face the different challenges that real turtles have to live in the world, I was able to see what color lasted the longest by making a plot that counted every turtle and turtle color.


Languages

We all speak a language, but why do we need to speak a language? To communicate right? Its the same with computers because computers talk with other computers. But just as everyone on earth does not have the same language its the same with computers. There are many different computer langueges that computers speak in. Including; Javascript, HTML, Python, and C++ just to name a few. Computers communicate when you surf the web, visit a website, or if you write out a website.



Python Programming

Python is one of the many computer programming languages that is used. It is a high level language and its main objective was to make a code that is easy to read. Companies like Google,Yahoo, and Linux. Also Battlefield 2(video game) is written with Python. Python was coded by Guido van Rossum (who now works for Google) who wanted to do something during his Christmas Vacation, so he decided to write a programming language.





After Break we got to play with Python and just like on net logo we started by making a square like below.




Then we made a square wheel


And that was the end of playing with the shapes on Python, the next thing we did was:

!!!!!!LECHUGA Game!!!!!!

YES!!! Everyone loves the mighty Lechuga, which is why we made a game for it. Technically we just programmed python to respond to user input, but we had to make it more fun, so we added Lechuga.




Again, because Python was responding to my user input I put it in the code, and then I typed what I wanted my computer to do. What I want to do is to have my computer respond to my response. The question it asked me was, "What is your name?", and I wanted it to answr only to the name Lechuga so I defined the name as "Lechuga". But when I tested it, it didn't keep answering if the name was wrong, so instead of typing lechugagame(the name name of the code) I added a repeat so it kept asking until it got the right answer as you can see below.


Algebra Solver

After some fun with Lechuga, we got to play with some math equations on python. The equation I used was a Algebra equation and we were solving for x with 4 variables. We used this code which was basically the equation of the Algebra Function.




I personally think this was awesome because instead of just buying a calculator and punching in some numbers not proving that I learned anything, I can prove that I learned the math equation.

Average

On Thursday we continued our work with Python creating more codes that can solve math problems. So we decided to try and solve for the average of our input. As we continued testing out our code, Mr. Farrell decided that we should solve one of the supposedly prime numbers(4294967297). So we tested it with this code.




And the answer was: