Monday, February 18, 2019

CS50 - week 1 - Intro to C

CS50 - week 1 - Intro to C

lecture 1
So, last week all the coding was in scratch. Which is a program made by MIT to visually represent code. It's also not that difficult to use (the latest version does seem to be difficult to embed, though). So in this lecture we (we as in, every student following this course) get introduced to the language of C. An old programming language designed in 1973 which is pretty much the opposite of scratch.

First the lecture shows a comparison between C and scratch, which makes C appear not to bad at first glance (, This isn't true at all at second, third... glance). It contains some nuisances such as a semicolon (";") after every line of text and the program throwing a fit if you don't. The basic loops and if/else conditionals get compared from scratch to C. Some background info on compilation was given (compilation, like I understand it, turns the lines of C text into 1's and 0's that the computer can read) and some more functions were shown. So, I still know next to nothing but the first C problem set shouldn't be that difficult, right?

problem set 1

So , the first problem set (the one from previous week counted as problem set 0) was rather manageable. There were 5 problems, only 3 were compulsory but I didn't feel the need to skip any as I feel practice is the best way to learn something. The problems are divided into two categories, for those less comfortable with coding (easier versions) and those more comfortable (harder versions).

Hello.C (easy version)
Have the program print 'Hello world!\n", as this was shown in the lecture, this was not difficult at all and only took 10 minutes. (I ofcourse forgot the semicolon so it threw an error, then I forgot the "\n" so it did not start a new line. Therefore, pretty much everything that could go wrong, did go wrong).

Hello, world\n

Mario.C (two versions, easier and harder)
the tl:dr pf problem set 1 said to listen to part of lecture 2, so I watched that in whole. Because an example was given during this lecture that was rather similar to these two tasks, the logic which should be typed out was immediately apparent to me (nested loops of # and spaces). So the major difficulty was wading through the 20 errors I got while making this. It only took 45 minutes 😌.
Then the harder version, which was only slightly more then the easy version. Also I could cannibalize the code of that version and only had to add one more loop in the nesting. I was a bit to "overzealous" in that I added spaces after # which weren't necessary (that is, it was wrong).

      n = 4

      #  # 
    ##  ##
  ###  ###
####  ####
The hard version separates the two pyramids of #, the easy version doesn't.

Cash.C ("easy")
Easy between quotes here, this wasn't that easy.
So, what was the task?
If I have an amount of cash, was is the least amount of coins of 0.01,0.05,0.1 and 0.02 required sum to that amount?
so if I would have 1.06 cash (of any valuta), the coins would be 5x0.2, 1x0.05 and 1x1.01 (I would need to have 7 coins minimum, I could also choose for 106 coins of 0.01, but thats unweildy).
The annoying problem here is that numbers that aren't integers in programming have the nasty habit of exhibiting rounding errors. Which can apperently be solved by multiplying and dividing by the amount of significant numbers. This problems was another hour.

Credit.C (hard)
So, given a number, tell me if it is one of the given credit cards or invalid. The requirements for the numbers are given : amount of numbers, the first number(s) as well as a stupid sum. The sum of every number plus every second number (so, these count twice) must be divisible by 10 (the last digit must be 0). This problem about as much time as the others here combined.

So the entire problem set was only 4 hours of work.

Thursday, February 14, 2019

CS50 - Intro to Computer Science - Week 0

cs50 - week 0 - scratch


"It's not the easiest way to learn it, but it is the best way"

On edx, you can follow this course for free. It has the recorded Harvard lectures and the same problems as the students of the Harvard University students.

lecture 0
A lot of the first lecture puts the emphasis on the fact that you don't need any programming experience. Apperently, even the lector , David Malan, didn't go to the University with the plan to study computer science. There's also some statistics about how the majority of students had no prior contact with programming and you should (logically) not compare yourself with others, but with where you started. Which is pretty good advice for everything you want to learn.

To start the course somewhat lighthearted, no coding takes place in the first lecture. Just a small bit on binary, a bit about how literal computers interpret commands and finnaly an introduction to Scratch. Scratch is a visual "coding" program designed by MIT meant for children but can be used as a way to introduce some concepts like loops and conditionals.


problem set 0

The first problem set is rather easy, just make anything you want in Scratch with a few requirements:
Your project must have at least two sprites, at least one of which must resemble something other than a cat.
Your project must have at least three scripts total (i.e., not necessarily three per sprite).
Your project must use at least one condition, one loop, and one variable.
Your project must use at least one sound.
Your project should be more complex than most of those demonstrated in lecture (many of which, though instructive, were quite short) but it can be less complex than Oscartime. As such, your project should probably use a few dozen puzzle pieces overall.
I made a poor imitation of flappy bird in about 2 hours.



(So... restarting this doesn't seem to work when not on the scratch site, so you should refresh the page for that. Also be wary of errors...)

Friday, November 24, 2017

RCT 1 - Gentle Glen

Gentle Glen

The next scneario has an odd restriction: guests prefer an intensity below 4 and stop riding rides somewhere around 6. It's also a somewhat hilly small island. Getting 1200 guests in here won't be very difficult, but getting the high amount of guests I got in Future World won't be possible.

Unlike the previous scenario's, I researched gentle rides first (and some roller coasters), Which seems to attract guests somewhat slower than usual. This park researches (as far as I know) every gentle ride, but the amount of roller coasters and thrill rides is rather restricted. One annoying aspect I had was that my side-friction coaster crashed like three times... It wasn't built that well apparently. Because of the focus on smaller attractions my park value and company values were some of the lowest I ever got.

Objective: 1200 guests in 3 years
Difficulty: Moderate
Final guests: 1.538 (New record, up 11 from Crumbly Woods)
Park Value: 32.600€ (New record, up 11.000 from Crumbly Woods)
Company Value: 81.000€


Monday, November 20, 2017

Thursday, November 16, 2017

RCT 1 - Future World

The second large map of the expansion (after Three Monkeys Park), it's quite flat and you start with a nice coaster. The goal is the highest I met yet (1500 guests in 3 years), but in this park, that goal seems really doable and even rather easy.

As I do most of the time, I started with researching roller coasters (but this time I forgot to increase the funding immediately...). I think this park has about every coaster available except for the steel coaster (which incidentally, is the most profitable one with its shuttle loops). By the time the park ended my park contained 23 coasters (including one virginia reel and the original vertical coaster) and a monster park value of about 75.000. I slightly improved my guest count over Crumbly Woods (my previous record) and blew that of Park Value away. The Company Value was the third largest I ever got in three years ( trailing only Mel's World and White Water Park).

This scenario was quite a breath of fresh air where it seems you could just build a lot of coasters in the open space. I like. After playing this park, I can confirm that it is not difficult at all.


Objective: 1500 guests in 3 years
Difficulty: Easy
Final guests: 2.238 (New record, up 11 from Crumbly Woods)
Park Value: 75.000€ (New record, up 11.000 from Crumbly Woods)
Company Value: 176.000€


Tuesday, November 14, 2017

RCT 1 - Fun Fortress

Fun Fortress

Scenario nr.7 . Same goal as Canary Mines, but without any initial built rides. You start with a smallish hilly park with a 'wall" on its edges. removing the pathing system of the fortress netted me a cool 3.000€. 

So I first made us of the available gentle rides and then build some roller coasters. I checked the initial shops and stalls and noticed all the requirements are there, so I first researched some roller coasters. And with some, I mean that it took until October year 2 to research "em all, which means I ended up with a lot of coasters (15, building all but the most annoying to build, such as bobsled and suspended coasters).

After having all the coasters, I researched some stalls and then went on with gentle rides instead of the usual thrill rides. I ended up with a suprising amount of guests... in the negative sense, just a tad bit above 1.500. Is it because I researched gentle rides instead of thrill rides? maybe they attract more?



Objective: 1300 guests in 3 years
Difficulty: Moderate
Final guests: 1.532
Park Value: 48.600€
Company Value: 91.000€




Thursday, November 9, 2017

RCT 1 - Haunted Harbor

Haunted Harbor

The sixth scenario of the corkscrew follies expansion. A relatively small park (larger than Pokey Park, about the same as Mystic Mountain), but that can be expanded as there is plenty of land to buy. But while the initial park is rather flat, the extra land is hilly as hell, so I did not buy much extra.

Due to park size, I built much more compact than on the previous parks of corkscrew follies, with tracked rides above each other (sometimes three layers, such as wooden coaster with steel mini on top of it, with the mine train on top of that one). But neither buying land nor cramming as hard as I did is really necessary to get 1200 guests required.

While normally I try to research all roller coasters first, here I only researched a few and then started researching thrill rides and later gentle rides. As you can see, it is pretty full even without a crapload of coasters.



Objective: 1200 guests in 3 years
Difficulty: Easy
Final guests: 1.847
Park Value: 37.100€
Company Value: 98.000€