Akalic
01-25-2011, 01:20 AM
What is all this about?
This is what happens when I have a light semester and an overwhelming urge to make random people on the Internet to suffer. Well... not really suffer, but I assume that learning how to program takes some level of pain and suffering. No longer will copy and pasting various functions you find on Google cut it, you will be able to actually write your own code (and damn good code, no O(n^3) programs here).
Why should I listen to what you're blabbing about?
I'm a third year Computer Science student and I know how to code. What allows me to make that claim? Numerous all-nighters, professors grading on a binary scale (100 or 0, nothing else) and still passing, and being able to code in Scheme without losing 95% of my brain functionality. You name any programming language and I'll be able to set up the integrated development environment (IDE), learn the syntax, and bust out the program within the day.
How will you help me?
I will post various programming books that I have "purchased" over my years weekly. These books will start out as simple introductory books on easy to learn languages and, hopefully, will evolve to my books on more intense topics. And given a significant interest in this thread (at least one or two victi... I mean, students) I will also post assignments for the week's topic, usually a quick program to flex your skills with a language or topic.
January 24, 2011
Books of the week: C++ for Dummies (http://www.speedyshare.com/files/26470790/C_For_Dummies_5th_Edition.pdf) and C for Dummies (http://www.speedyshare.com/files/26470789/C_For_Dummies_2nd_Edition.pdf)
As far as first languages go, C and C++ are ideal. Both share nearly exactly the same syntax (the wording of the language), making learning both a breeze. C++ is an easy to learn language with many free IDE programs, I highly suggest DevC++ (http://www.bloodshed.net/devcpp.html) for your first IDE program. Another plus is that C and C++ can be compiled on the same IDE. C++ is an Object Oriented Programming (OOP) language, meaning that you can create classes and objects which makes many programming assignments (especially Graphical User Interface (GUI) programs, which are technically anything that isn't text-based). C is an older language where C++ gets much of its structure from, but it does not have any OOP support or any fancy features that C++ has. Some would think this is a bad thing, but in fact it is a massive plus for the language. By not having things like memory allocation, type casting, and networking done automatically by either the IDE or the language itself, you learn about the inner workings of programs and how to code with some appreciation that you don't have to use malloc() for every variable you wish to keep around.
March 7, 2011
Books of the week: Clean Code: A Handbook of Agile Software Craftsmanship (http://www.speedyshare.com/files/27274283/Clean.Code.A.Handbook.of.Agile.Software.Craftsmans hip.pdf) and 97 Things Every Programmer Should Know (http://www.speedyshare.com/files/27274285/97-Things-Every-Programmer-Should-Know_Collective-Wisdom-From-The-.pdf)
This week I deviate from teaching you new languages in order to make you better at what you already have a basic grasp of. Clean Code is a great handbook at teaching you how to write your code in a clean and efficient way so others can read and understand your code without losing their minds in the process. No longer will you name variables a, b, and c. You will learn that making detailed names of variables, even the tiny integer variables for loops, is the proper way to write your code. 97 Things is a collection of essays from programmers in the field that tell about some horror stories that they have experienced in their line of work. Learning how to program from text books is fine and dandy, but in order to become a master of the art of programming, you have to learn by experience. This book lets you do the same learning but without the pain and suffering of looking for a logic error in a program 3000 lines long.
Assignments
Assignments will be listed from easiest to hardest. Most assignments can be completed in any of the languages I offer through my books, but if I decide to teach a language that is very specific (like Scheme) I will mark the assignments that cannot be done in that language. If my wording of the assignment leaves you with questions or suggestions, please refer to the Contact Me section to get on my ass about it.
Write a program that prints out "Hello World" five times, each on a new line, using a for, while, or do-while loop.
Write a program that prints out "3 + 4 - 2 *25 = " (whitespaces included), and calculates the answer, and finally prints the answer on the same line.
Write a program that prints out a two column table using the following data
Players: Bob, John, Jill, Tommy, Shasha, Derick
Score: 32, 12, -2, 300, 0, 42
Use the '\t' escape character to format the table to look like this:
Players <-- \t -> | Score
____________________
Name <--- \t ---> | Score
Write a program that uses various sorting algorithms to place a 15 slot array of random, positive integers (0-100) in DESCENDING order. When you run the program, it will print out the unsorted array and three options below it, "Bucket Sort," "Quick Sort," and "Bubble Sort." Each option will be numbered 1-3 and the program will be waiting for you to input an integer. Once you input an integer, it will check if it is valid, if it is not (like you put in a 5) it will clear the console and reprint the array and options. Once you are sure the input is correct, run the sorting algorithm assigned to that number. After the program sorts the array, it will clear the screen and print the sorted array with a message, "Generate new array? (Y/N)." If Y, clear the console and generate a new random array with the same options. If N, exit.
As for the algorithms, lets assume you name your array ran_arr Bucket sort requires that you find the largest number in ran_arr and make another array of that length (temp_arr). And then you assign every integer in ran_arr into temp_arr[integer]. This means if there is a 5 in ran_arr, you put a 5 in the 5th slot in temp_arr. Once temp_arr has all 15 integers stored, it will print itself, ignoring the numerous null slots it contains. Bubble sort and Quick sort are too bitchy for me to write, so here's some queer robots. (http://www.youtube.com/watch?v=vxENKlcs2Tw) Be aware that Quick sort uses recursion, so make sure to read about that before taking this on.
[ADVANCED] Write a program that asks the user for an integer and preform a Fibonacci sequence up to that integer:
Enter Number: 4
Fib Seq: 0, 1, 1, 2 Make sure to print the correct number of commas and whitespaces. This assignment will use recursion, not loops, be sure to read up on recursion functions and how to correctly compute the answer using a helper function and the correct base case.
[ADVANCED][For extra points, write this in C using structures] Write a program that simulates a library with books that can be checked in or out. The library should be able to print out a list of books it contains with its current status (checked in/out) and end the list with the sum of all the books, the sum of all books checked in and all books checked out. Use this format
BOOK_NAME - STATUS
BOOK_NAME - STATUS
...
XX Books in collection: XX in stacks, XX Out
[ADVANCED] Write a program that finds all the prime numbers up to n, where n is a positive integer that the program will ask as input when it is ran. The program will save the output of prime numbers in a file called “list.txt” in the same directory as the program. The file itself will have a header that will name the program that created it and what it lists.
Ex. list.txt
Created by prime.exe
List of prime numbers up to 22
1
2
3
5
7
11
13
17
19
[GOD TIER][JAVA OR C++ ONLY] Make Pong. The definition of the game itself should be easy for you to learn, but there will only be one paddle controlled by the mouse. This means you will draw the paddle based on the mouse’s position, no clicking required. The player will be playing against the wall which makes up the entire right side of the playing field. Of course the ball must bounce off the wall at the same angle it hit, meaning that if the ball hits the far right wall going downward and towards the wall at a 30 degree angle, it will change its velocity to be downward and away from the wall at 30 degrees (Hint, think of the movement of the ball as two separate numbers, the movement in the X axis and the movement in the Y axis. So when the ball hits the wall, depending on which axis that wall follows, you change the respective movement number by a factor of -1). The score will be the number of times the player can hit the far right wall, the game ends when the player misses the ball with the paddle and the ball passes the far left boundary. The speed of the ball will be handled by a standard class of the language, use Google to find the right classes to use. Another restriction is that contact with objects (ie. The paddle and walls) do not affect the ball’s speed, however, the ball’s speed will be changed every 5 points the player scores. The manner of change in speed is up to you, but I recommend either a flat increase in speed or using a random number generator to choose the increase in speed (I recommend setting the RNG to choose between a small variance of numbers so the player isn’t boned when his game makes the ball go faster by 10^22 frames). And for extra credit you can create a highscore list that is saved into a file and loaded to print the list.
This is what happens when I have a light semester and an overwhelming urge to make random people on the Internet to suffer. Well... not really suffer, but I assume that learning how to program takes some level of pain and suffering. No longer will copy and pasting various functions you find on Google cut it, you will be able to actually write your own code (and damn good code, no O(n^3) programs here).
Why should I listen to what you're blabbing about?
I'm a third year Computer Science student and I know how to code. What allows me to make that claim? Numerous all-nighters, professors grading on a binary scale (100 or 0, nothing else) and still passing, and being able to code in Scheme without losing 95% of my brain functionality. You name any programming language and I'll be able to set up the integrated development environment (IDE), learn the syntax, and bust out the program within the day.
How will you help me?
I will post various programming books that I have "purchased" over my years weekly. These books will start out as simple introductory books on easy to learn languages and, hopefully, will evolve to my books on more intense topics. And given a significant interest in this thread (at least one or two victi... I mean, students) I will also post assignments for the week's topic, usually a quick program to flex your skills with a language or topic.
January 24, 2011
Books of the week: C++ for Dummies (http://www.speedyshare.com/files/26470790/C_For_Dummies_5th_Edition.pdf) and C for Dummies (http://www.speedyshare.com/files/26470789/C_For_Dummies_2nd_Edition.pdf)
As far as first languages go, C and C++ are ideal. Both share nearly exactly the same syntax (the wording of the language), making learning both a breeze. C++ is an easy to learn language with many free IDE programs, I highly suggest DevC++ (http://www.bloodshed.net/devcpp.html) for your first IDE program. Another plus is that C and C++ can be compiled on the same IDE. C++ is an Object Oriented Programming (OOP) language, meaning that you can create classes and objects which makes many programming assignments (especially Graphical User Interface (GUI) programs, which are technically anything that isn't text-based). C is an older language where C++ gets much of its structure from, but it does not have any OOP support or any fancy features that C++ has. Some would think this is a bad thing, but in fact it is a massive plus for the language. By not having things like memory allocation, type casting, and networking done automatically by either the IDE or the language itself, you learn about the inner workings of programs and how to code with some appreciation that you don't have to use malloc() for every variable you wish to keep around.
March 7, 2011
Books of the week: Clean Code: A Handbook of Agile Software Craftsmanship (http://www.speedyshare.com/files/27274283/Clean.Code.A.Handbook.of.Agile.Software.Craftsmans hip.pdf) and 97 Things Every Programmer Should Know (http://www.speedyshare.com/files/27274285/97-Things-Every-Programmer-Should-Know_Collective-Wisdom-From-The-.pdf)
This week I deviate from teaching you new languages in order to make you better at what you already have a basic grasp of. Clean Code is a great handbook at teaching you how to write your code in a clean and efficient way so others can read and understand your code without losing their minds in the process. No longer will you name variables a, b, and c. You will learn that making detailed names of variables, even the tiny integer variables for loops, is the proper way to write your code. 97 Things is a collection of essays from programmers in the field that tell about some horror stories that they have experienced in their line of work. Learning how to program from text books is fine and dandy, but in order to become a master of the art of programming, you have to learn by experience. This book lets you do the same learning but without the pain and suffering of looking for a logic error in a program 3000 lines long.
Assignments
Assignments will be listed from easiest to hardest. Most assignments can be completed in any of the languages I offer through my books, but if I decide to teach a language that is very specific (like Scheme) I will mark the assignments that cannot be done in that language. If my wording of the assignment leaves you with questions or suggestions, please refer to the Contact Me section to get on my ass about it.
Write a program that prints out "Hello World" five times, each on a new line, using a for, while, or do-while loop.
Write a program that prints out "3 + 4 - 2 *25 = " (whitespaces included), and calculates the answer, and finally prints the answer on the same line.
Write a program that prints out a two column table using the following data
Players: Bob, John, Jill, Tommy, Shasha, Derick
Score: 32, 12, -2, 300, 0, 42
Use the '\t' escape character to format the table to look like this:
Players <-- \t -> | Score
____________________
Name <--- \t ---> | Score
Write a program that uses various sorting algorithms to place a 15 slot array of random, positive integers (0-100) in DESCENDING order. When you run the program, it will print out the unsorted array and three options below it, "Bucket Sort," "Quick Sort," and "Bubble Sort." Each option will be numbered 1-3 and the program will be waiting for you to input an integer. Once you input an integer, it will check if it is valid, if it is not (like you put in a 5) it will clear the console and reprint the array and options. Once you are sure the input is correct, run the sorting algorithm assigned to that number. After the program sorts the array, it will clear the screen and print the sorted array with a message, "Generate new array? (Y/N)." If Y, clear the console and generate a new random array with the same options. If N, exit.
As for the algorithms, lets assume you name your array ran_arr Bucket sort requires that you find the largest number in ran_arr and make another array of that length (temp_arr). And then you assign every integer in ran_arr into temp_arr[integer]. This means if there is a 5 in ran_arr, you put a 5 in the 5th slot in temp_arr. Once temp_arr has all 15 integers stored, it will print itself, ignoring the numerous null slots it contains. Bubble sort and Quick sort are too bitchy for me to write, so here's some queer robots. (http://www.youtube.com/watch?v=vxENKlcs2Tw) Be aware that Quick sort uses recursion, so make sure to read about that before taking this on.
[ADVANCED] Write a program that asks the user for an integer and preform a Fibonacci sequence up to that integer:
Enter Number: 4
Fib Seq: 0, 1, 1, 2 Make sure to print the correct number of commas and whitespaces. This assignment will use recursion, not loops, be sure to read up on recursion functions and how to correctly compute the answer using a helper function and the correct base case.
[ADVANCED][For extra points, write this in C using structures] Write a program that simulates a library with books that can be checked in or out. The library should be able to print out a list of books it contains with its current status (checked in/out) and end the list with the sum of all the books, the sum of all books checked in and all books checked out. Use this format
BOOK_NAME - STATUS
BOOK_NAME - STATUS
...
XX Books in collection: XX in stacks, XX Out
[ADVANCED] Write a program that finds all the prime numbers up to n, where n is a positive integer that the program will ask as input when it is ran. The program will save the output of prime numbers in a file called “list.txt” in the same directory as the program. The file itself will have a header that will name the program that created it and what it lists.
Ex. list.txt
Created by prime.exe
List of prime numbers up to 22
1
2
3
5
7
11
13
17
19
[GOD TIER][JAVA OR C++ ONLY] Make Pong. The definition of the game itself should be easy for you to learn, but there will only be one paddle controlled by the mouse. This means you will draw the paddle based on the mouse’s position, no clicking required. The player will be playing against the wall which makes up the entire right side of the playing field. Of course the ball must bounce off the wall at the same angle it hit, meaning that if the ball hits the far right wall going downward and towards the wall at a 30 degree angle, it will change its velocity to be downward and away from the wall at 30 degrees (Hint, think of the movement of the ball as two separate numbers, the movement in the X axis and the movement in the Y axis. So when the ball hits the wall, depending on which axis that wall follows, you change the respective movement number by a factor of -1). The score will be the number of times the player can hit the far right wall, the game ends when the player misses the ball with the paddle and the ball passes the far left boundary. The speed of the ball will be handled by a standard class of the language, use Google to find the right classes to use. Another restriction is that contact with objects (ie. The paddle and walls) do not affect the ball’s speed, however, the ball’s speed will be changed every 5 points the player scores. The manner of change in speed is up to you, but I recommend either a flat increase in speed or using a random number generator to choose the increase in speed (I recommend setting the RNG to choose between a small variance of numbers so the player isn’t boned when his game makes the ball go faster by 10^22 frames). And for extra credit you can create a highscore list that is saved into a file and loaded to print the list.