Lesson 02

(Please ignore this - these are notes for myself for the next iteration of this course)

Add for next time:

  • We can cover the return value of TryParse, and should. 
  • LOOK AT THE LESSON 09 INSTRUCTOR NOTES ABOUT MONOGAME AND THE OPENAL ERROR!!!

PCE feedback:

  • Game stuff, generally
    • "It's complicated" - I wonder if this is because we're jumping to later exercises?
    • More info on debug mode in order to test the program quickly?
  • Multiway If/else
    • Directions are tricky - I think there's too many ball/block combinations? 
      • Maybe a clear 'vision' ("there's three types of balls - fire, ice, normal.  Here's what they do") plus a chart?
    • It's not clear where the code should go - people keep modifying stuff outside the area
      • Make it clear by specifying nested if/else, maybe putting the skeleton inside?
    • The 'unrevealed' thing caused a lot of problems - remove it?  Describe it better?
  • Logical Ops
    • Directions are tricky - I think there's too many ball/block combinations? 
      • Maybe a clear 'vision' ("fire balls remove ice blocks", and vice-versa) combined with a chart of some kind?
      • Add code for stuff that isn't really the focus of the exercise?

Exercises from prior quarters

From earlier

  1. Exercise: String Basics (Sect. 16.2) (Hand-In)
    (You may want to use this exercise as a springboard for posting questions / answers (to the Google group) about how to make good use of online help, both on the Internet, and inside Visual Studio's online help system.
    REMOVE VS's HELP - REMOVE THIS ENTIRELY?

  2. Exercise: Read through the SimpleIf tutorial (Required)
    1. This will show you some of the basic aspects of the API for the game (API = functions you can call to make things happen in the game), and show a very simple usage of an if statement.
    2. Note that many of the game tutorials may contain links to explanation videos.  You are NOT required to watch any of the game videos, although you may find it useful to do so. 
      Note that the tutorials specify how long each video is (what the duration is) so you know how long the video will be before you start watching. 
    3. Note that the code samples in the game tutorials use Java instead of C#.  You'll notice that there's a table labeled 'Warning: Language Differences' which will tell you to replace Java's KeyEvent.VK_SPACE with C#'s Keys.Space, for example.  While the C# project correctly uses C#, you will need to fix any code that you copy-and-paste from the tutorial into your program.
    4. While you will use the knowledge you gain from this tutorial in future exercises, there is nothing that you are required to hand in for this tutorial.
    5. For this exercise you are required to post something to the 'Did you get the 'BlockBreaker' game to work in PCE 02? ' discussion group. 
      You need to post one of two things:
      1.  A quick post saying "Yes, I got it to work", or
      2. A post saying "No, it didn't work".  
        You must include the version of Windows that you're running (ex: Windows 7)(Ex: Mac + Parallels with WIndows 7), which version of Visual Studio you have installed (look for it in Help->About if you've forgotten), and whether you successfully installed XNA 4.0 or not.
      3. If you posted this already (in Lesson 01) you do NOT need to post this again
    6.   
  3. EXTRA CREDIT:
    The following items are NOT required for this course. 
    Successfully completing them will earn you as much as 5 ponts of extra credit (total)
    1. EXTRA CREDIT:
      Exercise
      : Read through the SimpleIfWithTravelingBall tutorial (Required)
      1. This will show you how to make the ball bounce off the paddle and off the edges of the screen.
      2. The notes about the game tutorial videos and the tutorials' usage of Java vs. C# is still relevant to this tutorial.  These notes won't be mentioned again after this tutorial.
      3. While you will use the knowledge you gain from this tutorial in future exercises, there is nothing that you are required to hand in for this tutorial.
    2. EXTRA CREDIT:
      Exercise
      : Read through the IfElseMultiway_WithBlocks  tutorial (Hand-In
      1. This will show you how to make the ball bounce off the paddle and off the edges of the screen.
      2. You need to complete exercise #1.
        1. For this and all future exercises, please do whatever exercise is linked to even if the text of the above link doesn't agree with the exercise that the link actually goes to.  In other words, if the above link says "exercise #1" but the following the link takes you to exercise #2 then please do exercise #2.
          (And please post a mesage to the course discussion forum so the instructor knows to fix it - thanks!)
        2. Do all the work for this exercise by modifying the C# starter project for this tutorial (the link to the project is on the tutorial page, near the top). 
          Note that this project is different than the starter project for the prior tutorials so you will have to download it.
          1. You will specifically need to modify the Game.cs file.
        3. In order to hand this in you will need to find the Game.cs file (and ONLY the Game.cs file) for this tutorial (located in CSharp.zip\BlockBreaker\BlockBreaker\BlockBreaker) and then copy it into a folder named IfElseMultiway_WithBlocks inside folder that you will submit for grading (by .ZIPping that folder).
          Note that the starter project for this week already has a folder with that name, and a text file with a note making it clear that you should put the Game.cs file there.
    3. EXTRA CREDIT:
      Exercise
      : Read through the LogicalOperators_WithBlocks  tutorial (Hand-In
      1. This will show you how to make the ball bounce off the paddle and off the edges of the screen.
      2. You need to complete exercise #1
        1. Do all the work for this exercise by modifying the C# starter project for this tutorial (the link to the project is on the tutorial page, near the top). 
          Note that this project is different than the starter project for the prior tutorials so you will have to download it.
          1. You will specifically need to modify the Game.cs file.
        2. In order to hand this in you will need to find the Game.cs file  (and ONLY the Game.cs file) for this tutorial (located in CSharp.zip\BlockBreaker\BlockBreaker\BlockBreaker) and then copy it into a folder named LogicalOperators_WithBlocks inside folder that you will submit for grading (by .ZIPping that folder).
          Note that the starter project for this week already has a folder with that name, and a text file with a note making it clear that you should put the Game.cs file there.
          1. As you can see, the way you'll submit your game-related work follows a standard, easy-to-follow format.  Thus there will be no further instructions specifying where to put things for future exercises.
  4. Exercise: Getting ready for the next lesson's video-game based programming: download, compile, and  run the Match3 game. (Required)
    This link takes you to the tutorial page for the Match3 game (which we'll be using in next week's lesson) - make sure that you can download and compile the game, and make sure that you've played the finished game enough that you understand (at least basically) how the game is played.
    Note that there's nothing to hand-in for this exercise.
  5.  

Feedback / Improvements on exericses:
(Please ignore this - these are notes for myself for the next iteration of this course)

PUT SOMETHING EXPLAINING THAT THE PREVIEW VIDEO FILE NAMES != THE LINK TEXT ABOVE; THE ORDER IS THE SAME, BUT THE NAMES ARE VERY, VERY DIFFERENT

TODO:
Move the first line in the ICEs forwards

Redo voting:

  1. While Loops

  2. For Loops
    x1 Student questions not as clear as in others

  3. Do-While Loops

  4. Increment (++) and decrement (--) operators

  5. Compound operators (+=, *=, etc)

  6. Random Numbers: Seed Values
    x3 Redo: This could be much shorter (a couple sentences rather than several mintues) x3

  7. Random Numbers: the .Net-specific .Next(min, maxPlusOne) method
    x1 Questions at end

  8. Random Numbers: Seed Values & non-random numbers

  9. Random Numbers: Using the plain .Next() & modulus ( % )

  10. Basic Parameters
    x1 The difference between Call Stack and Stack Frame is difficult to understand. Also - call stack vs. stack

  11. Basic Return Values
    x3: Rushed at the end? x2

 

SpaceSmasher:

A note about finding subprojects:
The project for this is inside the .ZIP starter project for this week.  When you open the .ZIP you'll see a folder named Normal_Console_Project.  Inside there you should see the Visual Studio Solution file (named "PCE_02").  Double-click on that solution file and VS should open the normal "Console-based" project correctly. ("Console" refers to that window that appears when you're doing Console.WriteLines and .ReadLines)
adsf

  1. Exploring Conditional Statements With The SpaceSmasher Game:
    Setting Up SpaceSmasher
    This section will show you how we might apply the conditional statements to improve "SpaceSmasher" a fun, 'block breaker' style game.

    1. VIDEO: Here's a short (45 second) video showing the overall style of the game - more-or-less how it's played, how it looks, and what it sounds like.
      (You do NOT need to outline this video - just watch it, get a feel for what the game is supposed to be, and be happy that you've now gotten college credit for watching a YouTube video :)  )

      1. Late breaking change (2:40pm on 10/6/2014): If you want to play the finished version of the game please extract the starter project's .ZIP file, then open up the Example Solution folder, then double click on the SpaceSmasherCSharp.exe file.  As long as you've got OpenAL and .Net installed then this should allow you to run the video game yourself.

    2. VIDEO: How To Get The Visual Studio Project To Compile And Run

    3. Exercise: Get the Visual Studio Solution for the game installed and running

      1. If you're working on your own computer then you're going to need to install OpenAL using this installer.  You will need administrator privileges but the installation itself is extremely small and quick (it only copies two .DLL files into your system directory)

        1. OpenAL is already installed on the computers at Cascadia - you do NOT need to install OpenAL on the school computers (including the VMWare Views)

      2. The game itself is inside the .ZIP for the starter project for this week - inside the .ZIP you'll see a folder named SpaceSmasher_Game_Project.  Inside that is anther folder, named SpaceSmasher (just SpaceSmasher - ignore the folder named SpaceSmasherLib).  Inside that you should see the Visual Studio Solution file (also named "SpaceSmasher").  Double-click on that solution file and VS should open the game project correctly.

        1. Note: Your instructor has opened, compiled, and run this project using the "Visual Studio Express 2013 For Windows Desktop" version of VS.  This project probably will not work on earlier versions of VS (although it might - try it but don't waste more than 5 minutes on if it doesn't work).  It *should* work in the Pro version of VS 2013, but your instructor hasn't actually tried it in that version. 

      3. At this point you should be able to use the "Start Without Debugging" option (under the "Debug" menu) to launch the game. 
        As always, if you run into trouble then you should try to fix it on your own for 5-10 minutes.  If that doesn't work then post a clear description of your problem to the disccussion group and resume trying to fix it.  If you can't fix it in 20 minutes or so then please go on to the next step (and just do the best you can).

afads
  1. Exploring Conditional Statements With The SpaceSmasher Game:
    Tutorial Topics
    All of the following exercises are from the 'Conditionals Lab' document. 
    I will keep refering to the 'Conditionals Lab' document but will not link to it to avoid people asking if all the links actually go to the same document or not.  They all refer to the above link.

    1. Exercise: Warmup With Single If Statements
      Within the 'Conditionals Lab' document, find the section with the title "Warmup With Single If Statements" (this is on or near page 3).  Write out the C# code that best expresses the English written on each line (which are numbered 1 through 8). 
      Please put your answer into the MS Word file named "Warmup With Single If Statements.docx" (which is already in the starter project .ZIP file)

      1. VIDEO: Warmup Exercises

    2. Exercise: Work Through The 'Lab Exercises' Document
      Within the 'Conditionals Lab' document, work through the following exercises.  
      NOTE: There are a lot of exercises marked as "Hand In" here, but the document walks you through pretty much all of them almost step-by-step.

      1. NOTE: The video talks about "ExampleSolution.cs" which was removed after the videos are recorded.  If you want to see an example solution follow the instructions in 3.A.I, above

      2. Topic: The Single If

        1. VIDEO: Spawning the ball when the user presses the space bar

        2. Exercise: TODO 0: Single Ifs to Spawn Balls Near Paddles  (Hand-In)
          Note: Once you're done the ball will spawn just above the paddle, then move downwards through the paddle and off the screen.  Later you will change the game so that the ball bounces off the paddle instead.

          Remember, the detailed description of this exercise (and all the other exercises in this section) are located in the 'Conditionals Lab' document

      3. Topic: The Single If
        Exercise:
        TODO 1: Single Ifs for Paddle & Ball Collisions  (Hand-In)

        (There is no video for this - read through the 'Conditionals Lab' document)
        Once you're done with this exercise the ball should bounce of the paddle.  When the ball first spawns (first appears) it should appear next to the paddle and start moving upwards.

      4. Topic: A Set of Sequential If Statements

        1. VIDEO: Moving the paddle left and right

        2. Exercise: TODO 2: Sequential If Statements  (Hand-In)

      5. Topic: The Single If
        Exercise
        :
        TODO 3: Single If Statements Revisited  (Hand-In)

        (There is no video for this)

      6. Topic: Transforming Sequential If Statements Into A Single If-Else Statement  
        Exercise:
        TODO 99: Transforming Sequential If Statements Into A Single If-Else Statement   (Hand-In)

        (There is no video for this)

      7. Topic: Compound Boolean Conditions (using && and ||)

        1. VIDEO: Using logical operators

        2. Exercise: TODO 4: Compound If Statements Using Logical AND (&&)  (Hand-In)

        3. Exercise: TODO 5: Compound If Statements Using Logical OR (||)  (Hand-In)

      8. Topic: Chained If/ElseIF Statements Without Default Else
        Exercise:
        TODO 6: Chained IF/ELSE Structures With No Default Else (A.k.a. Multi-way Ifs)  (Hand-In)

        (There is no video for this)

      9. Topic: Nested If Statements

      10. VIDEO: Nested if statements - implementing the minimum function

        1. Exercise: TODO 7: Nested If Statements  (Hand-In)

        2. Exercise: TODO 8: Nested If-Elses (A.k.a If-Elses Inside of If-Elses)   (Hand-In)

      11. Topic: Transforming Nested Ifs using &&
        TODO 9: Transforming Nested Ifs Using &&  (Hand-In)

        NOTE: This exercise will ask you to rewrite the code that you wrote in TODO 7, above.  Make sure to save a copy of your work from TODO 7 by copying that work (copy the entire minimum function), paste it into your programa, and comment out the function.

        (There is no video for this)

sdafad
  1. Special Note: How To Hand In Large Projects
    You'll notice that the video-game-based projects are huge - the downloaded .zip is something like 60 MB, and once you build the project it can easily grow to 120 MB.  Even when you compress this it's too much for your browser to upload to StudentTracker.  The upload limit for StudentTracker is probably around 1 MB. Here are instructions on what to remove in order to hand in your homework.

    1. There's a video here that will walk you through all of these steps

    2. First, MAKE A COPY OF YOUR WORK.  Copy the entire folder, even though the folder may be 120 MB+.  We're going to delete a ton of stuff and when we're done the program will no longer compile.  So copy the folder containing your starter project and all your work!

    3. Second, WITHIN YOUR COPY use the Windows Explorer search feature to find the folders named "bin" and "obj" and delete them.  The Windows Explorer search feature is near the top-right of the window you get when you ask Windows to show you the computer (Windows 7: Start --> Computer; Windows 8: Start Screen -> This PC).  On Win8 the search box is filled in with "Search This PC" (or "Search <name of directory that you're currently in")

    4. In the SpaceSmasher_Game_Project\SpaceSmasher folder delete the file named OBSOLETE.SpaceSmasher.zip.

    5. In the SpaceSmasher_Game_Project\SpaceSmasher\SpaceSmasherCSharp folder delete the folders named Resources and Support Files.

    6. At the top level, find the folder named Example_Solution and delete that, too.

    7. At this point you should find that the folder containing your work is now about 10 MB, and when you send it to the compressed folder the resulting .ZIP file will be about 3 MB in size.