Computers are amazing
Post Reply
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
19-02-2012, 04:49 PM
Thumbs Up Computers are amazing
So recently a friend gave me a link to the open courseware of MIT. I decided to study computer science and programming (which is one course).
In this course they teach you how a computer works and so on and also they teach you python.

Before that I had my nose in C for a very short while. But for some reason it annoyed me though I did not find it difficult just annoying. A few years before that I played around with html which I do not want to count as real programming but I think everyone has their own opinion on html about that.

So back to the now.
I worked on the first assignment which was fairly easy. You had to write a little code that asks you for your name and then prints it out.
So far so easy.
Next assignment was to write a program that will print out the 1000th prime number. Not so easy anymore. I thought about that program for a whole week. After that week I asked Malleus to help me (he doesn't know python but he does know C, so at least he has a brain for how to compute things like that). So he explained to me and I wrote it down in python and then we got stuck in making it run for all the syntax errors. When the syntax errors where gone there was some logical errors left and we did not find out what that is.
So at some point I looked at someone else's code just to get an idea. That code had a different structure but the hint we needed.
Anyway, overall it took us like 3 hours to solve this and I am very happy, and the programm works fine.

Now this got me to be very very amazed at what computers can do nowadays. Nowadays a mobile phone is able to do more than the first moon mission did. Isn't that amazing?
We have programms that calculate for us, that can write when we dictate (not very well but hey they can!), we have maps that calculate routes for walking and cycling and going by car, we have a gps that always knows where my car is on the road and that tells me where to go next! We have computers that read different things depending on where I touch the screen with my finger! We have DVD recorders that will record TV programms, we are able to friggin call people from a plane, we can save 100 books on a small e-reader and it will remember on what page I am in every book I read in, we have wrist watches that do all kinds of stuff and more more more, the friggin microwave is programmable!!

All the effort that went into doing all this. Even knowing that those are big teams, some people wrote all this down to a language out computers do understand!

It buffles me that we can actually get angry when the computer takes 5 seconds to load a page sometimes, but we can. We are all very spoiled.

I am amazed at what is happening with computers! Truly!
Wonderful!

The fact that I am here, sitting in my bed, in Ireland, typing this, and when I am done, I just click a button and people in USA, Russia, Egypt, Asia can read that! Amazing in my opinion.
You may all tell me to calm down but I think it is superamazing, very cool!

w00t

"Freedom is the freedom to say that 2+2=4" - George Orwell (in 1984)
Visit this user's website Find all posts by this user
Like Post Quote this message in a reply
[+] 5 users Like Leela's post
19-02-2012, 04:52 PM
RE: Computers are amazing
could you post the link to the course you're doing? I'd also like to play with some of that Smile

you're right computers are pretty amazing things Smile
Find all posts by this user
Like Post Quote this message in a reply
19-02-2012, 04:56 PM
RE: Computers are amazing
(19-02-2012 04:52 PM)morondog Wrote:  could you post the link to the course you're doing? I'd also like to play with some of that Smile

you're right computers are pretty amazing things Smile

Sure here you go! I am just having a problem loading that site, but I guess that's my slow connection. Have fun with it!

"Freedom is the freedom to say that 2+2=4" - George Orwell (in 1984)
Visit this user's website Find all posts by this user
Like Post Quote this message in a reply
[+] 1 user Likes Leela's post
19-02-2012, 05:33 PM
RE: Computers are amazing
You didn't even mention the one of the most amazing things people do with computers every day: 3D videogames. Big Grin

Every fraction of a second the computer processes your input, then calculates physics for many objects at once, then calculates and renders a 2D projection of the 3D scene.
Find all posts by this user
Like Post Quote this message in a reply
[+] 1 user Likes Ben's post
20-02-2012, 06:22 AM
RE: Computers are amazing
Now I want to see your solution for the primes problem. Smile Here's mine, quick and dirty (spoilers, so highlight the white text to see it):

Code:
# 0 and 1 are not prime, so 2 is the first prime.
primes = [2]
start = 3

def isPrimeSoFar(x):
    for p in primes:
        if x % p == 0:
            return False
    return True

for n in range(start, 1000):
    if isPrimeSoFar(n):
        primes.append(n)

print "The prime numbers between 0 and 1000 are: ", primes
Find all posts by this user
Like Post Quote this message in a reply
20-02-2012, 06:31 AM
RE: Computers are amazing
That looks interesting but I miss some of the things that you used. We used loops and made a counter.... I am at work right now, but I will post our code when I am home

didn't know you can define a range like (start, 1000)

"Freedom is the freedom to say that 2+2=4" - George Orwell (in 1984)
Visit this user's website Find all posts by this user
Like Post Quote this message in a reply
20-02-2012, 06:48 AM
RE: Computers are amazing
(20-02-2012 06:31 AM)Leela Wrote:  That looks interesting but I miss some of the things that you used. We used loops and made a counter.... I am at work right now, but I will post our code when I am home

didn't know you can define a range like (start, 1000)

I used 'for' loops. Were you using a 'while' loop? In Python, 'for' takes an array and does the thing in its body for each element in the array. The "p in" and "n in" parts assign the variable p or n to the value of the current element that it's operating on. So for example,

Code:
for x in [1,2,3]:
   print x

would print

1
2
3

It's basically doing this:

Code:
print 1
print 2
print 3

The range function produces an array of all the numbers between its first parameter and second parameter (inclusive), so the following code is equivalent to the two snippets above:

Code:
for x in range(1,3):
   print x
Find all posts by this user
Like Post Quote this message in a reply
20-02-2012, 07:16 AM
RE: Computers are amazing
23 years in the computer industry and I get peeved when my connection is slow.
Find all posts by this user
Like Post Quote this message in a reply
20-02-2012, 07:51 AM (This post was last modified: 28-04-2012 08:39 AM by lucradis.)
RE: Computers are amazing
Here's my python sudoku solver. It's pretty fast, usually less than 5 seconds. Big Grin



Edited By Admin By Request.


It loads the puzzle from a txt file called Puzzle.txt that looks like this:
Edited By Admin By request.
Find all posts by this user
Like Post Quote this message in a reply
20-02-2012, 09:17 AM
RE: Computers are amazing
well I know about for but I didn't really know how to put it in this code. we (malleus and me) used while

"Freedom is the freedom to say that 2+2=4" - George Orwell (in 1984)
Visit this user's website Find all posts by this user
Like Post Quote this message in a reply
Post Reply
Forum Jump: