Thursday 4 April 2013

SLOG Assignment


You are sitting in front of two drawers. The left drawer contains 64 pennies, the right drawer contains
nothing. Can you arrange things so that one of the drawers has 48 pennies, using combinations of the
following two operations, l and r?

L: If the left drawer has an even number of pennies, you may transfer half of them to the right drawer. If the left drawer has an odd number of pennies, operation l is disallowed.

R: If the right drawer has an even number of pennies, you may transfer half of them to the left drawer. 

If the right drawer has an odd number of pennies, operation r is disallowed.

Choose another number in the range [0,64]. Starting from the same initial position, can you arrange
things so that one of the drawers has that number of pennies? Are there any numbers in that range that
are impossible to achieve? What about starting with a different number of pennies in the left drawer?


Understand the problem.
- There are two drawers - Right and Left
- There are 64 pennies
- These 64 pennies are in the Left drawer.
- There are no pennies in the Right drawer
- You have to arrange the pennies in a way so that there are 48 pennies in one drawer.

Devise a plan.
- Start off with the 64 pennies being in the Left drawer.
- Divide the number of pennies in half and carry it over to the other drawer
- Continue this until you have 48 pennies in one of the drawers
- Create a flow chart to better understand the steps of this process.

Carry out the plan.
- The Left drawer has 64 pennies and the Right has none,
- Since 64 is a even number, 32 of it will be transferred to the Right drawer
- Assuming the the drawers will take alternative turns in making the transfer, this time the transfer of half the pennies will be made by the Right drawer.
- At this point, both drawers have 32 pennies
- Right transfers half which is 16 to the Left drawer
- Now, Right has 16 pennies and the Left has 48 ( 32 from the previous step + the 16)
- This goes on until we reach the combination 43 -21 which is when neither of the operations are allowed.

Extra 

- There are no other numbers other than 64 from 0-64 that you can start with in order to have 48 in one drawer other than when you start with 48 in one and 0 in the other. This is assuming that you always start with 0 pennies in one drawer and the multiples of 2 in the other drawer.
- If you try other combinations, since one of the drawers must always have an even number of pennies to make sure that they can be equally divided, the other drawer automatically ends up having another even number of pennies . As shown below.

 64-0, 62-2,60-4 , 58-6, 56-8, 54-10, 52-12, 50-14, 48-16, 46-18, 44-20, 42-22, 40-24, 38-26, 36-22, 34-30, 32-32, 30-34 .......

You can see a pattern here: Both numbers are always even. why ? Because in order to make one drawer even, to make at least one operation allowed, you end up taking away an even number of pennies from 64 all the time. And when you take away even numbers from bigger even numbers, you only end up with more even number since all even numbers are multiples of two!


Look back, figure out when and how you're stuck.
- I was stuck in the very beginning while thinking about how the drawers will alternative in the exchange, if they will.Then I realized that it does not matter since the requirement is that any one of the  drawer contains 48 pennies.

Wednesday 3 April 2013

Week 11

No tutorial !! :O yay ! no offense to the TAs .. we love you very much !

This week was about work. Work hours and how computers has changed the nature of work. We can now get things done faster and more efficiently, we work without even being at the workplace, we have machines to do the hard labor etc. All in all  whether computers have made the work environment a better place (utopia) or a not so better place (dystopia).

Week 10

This week we learned about operating systems and network ! The more interesting thing this week was however the recursion ! It was just the Sierpinski triangles where you had a condition but this was way more interesting since this time we learned to make it do so many cooler things !

Moving on... This week was also when part three  of the Wikipedia was due. Although I had picked 4-5 pages to edit in the first stage of the project, I later realized that despite the fact that these pages were marked as needing copy edits, when I read through them, they seemed to not be needing any. So I ended up editng only 3 of them.  I added more information to one page that was on a film, one on the new Indian rupee symbol and one on a sports stadium in Asia. I actually received feedback from one editor asking me to make sure I completed the edit summary and also gave me few other tips. I have to admit , I found this project very engaging and rewarding when I found out that the new wikipedia pages for the ones I edited contains my contributions especially because I knew a couple other people who were complaining about their work being deleted , Overall I really enjoyed this wikipedia assignment and I think that I really did contribute to that community which was the purpose of this assignment in the first place.

Friday 22 March 2013

Week 9 Term Test 2

A sierpinski triangle? what on earth is that ? well its the name of the guy Wacław Sierpiński who described it in the good old days of 1950s. First when I looked at the program and saw the word, I naively tried to find what the sierpinski function does on the Dr Racket manuals found online but to my dismay, there was no sierpinski function... well then what was it ? it was one of those functions  you "create" and tell it what to do and not a predefined racket function. Well anyway it basically just puts triangles on top of each other to get the distinct sierpinski triangle  as you see on the left here. Its kind of like the inception movie because the code adds layer on top of a layer each time to make  sierpinski triangle deeper and deeper or just larger and more complex. It was pretty cool I would say.


Now onto a less cheerful subject, the Term Test. dun dun DUN!!! I wrote all the number and hardware notes on my cheat sheet, examples of check expect statements, binary conversions and everything else we needed to know and I was on a pretty good roll during the test or that was what I thought.  I had all the answers right in front of me and I was filling them all in but then unfortunately we ran out of time which was really unfair because I had the answers but no time to write them down. Maybe next time we should get maybe an hour and a half to write it, and maybe in another lecture room so we do not have to rush to get out so the next class could get in. So it is my humble suggestion to the authorities reading this to consider more test writing time ! please !

Week 8

This whole week was spent stressing out about Project one .

The biggest problem was getting it to bounce back once it reached the end like it was originally programmed to do!! After much frustration and head scratching and on the day of... we, meaning me and my brilliant partner figured out that we were entering the wrong x and y values this whole time and we never told the program what to do once it reached the bottom of the window. Well that was stupid ! and the fox and mice program .... that was a whole other catastrophic !  But when you have a relentless partner like mine, shes going to make sure the job gets done !

Week 7

This week was all about the number ! binary , integer. integer, binary. at first it was a lot to take in all the zeros and all the conversions but in the end , it was pretty simple once you get the concept of it. To be honest, I actually did not understand when Mr.Heap taught it but eventually i got the hang out it when I watched this you tube video ! Oh and the part two of the wikipedia assignment. Just like the several other times i first started freaking out reading the instructions the part two ( i seriously think it the very official restrict sort of font its written in. They should consider a more friendly font like comic sans or something) but it was just basically reading the Help section of the community portal and writing a plan about how I am going to use that information to do the actual edits. One last thing, the quiz , on struts... well that too took me a while to get a hang of ( maybe im just slow o.O) but the whole concept was that one variable is pretty but like  a library that holds a bunch of characters - words, numbers, pictures, and then a list function pulls these characters out of the "library" and displays them when the user asks for it.

Friday 15 February 2013

Week 6


Finally a blog on time!

This week we learned more about how computers store and output information using the Boolean logic plus the binary method and how computers use them to process information. Maybe all my hard work trying to figure that out last week was not a waste after all. Overall this week went pretty smoothly, the prof taught how to add binary numbers in class and since I already knew that the lecture was a breeze. 

As always I watched the tutorial videos the night before the tutorial but I caught on pretty quickly with the list, list-ref, structs, etc. On the morning of the tutorial me and my friend went through the videos one more time and discussed our questions and doubts among ourselves and went to write the quiz which I noticed to have gotten a little bit more challenging than the ones before this. The questions were not as obvious and more detailed plus now we were required to complete 5 out of 6 questions whereas before it was only 60-70% of the questions but I am not complaining!