Chp 13 assignment

Your assignment is to modify the basic sprite program from chapter 13 in the following ways:

  • Make the black rectangles into blue circles/ellipses, keep them the same size.
  • Make the red player, into the spaceship from the graphics tutorial we did.
  • Add a sound to the program whenever the player eats 1 block. Choose a sound possibly from free-loops.com (http://free-loops.com/)
  • When the user eats up all the circles, end the game and display a message to the user in the console.

For tips on how to change the program to circles and a bitmap image, in the tutorial under chapter 13.1 there are details on how to do exactly that, it will require you modify parts of the main program as well,

http://programarcadegames.com/index.php?chapter=introduction_to_sprites&lang=en#section_13

Your assignment is due Fri May 5.

Advertisements

Chapter 13, Sprites

Let’s fix the sound bug from Friday’s class, login to your computer, and I will come by to run something in terminal, then rerun your file from Friday’s class to verify that the sound is now working.

Today, we are going to look at the sprite class. We will look at how to create blocks, if there is time we will look at how to keep track of the score when they collide with one another.

 

Follow along with Chapter 13, we will try to get to the end of chapter 13.1,

http://programarcadegames.com/index.php?chapter=introduction_to_sprites&lang=en#section_13

As usual, submit your finished file to the server when done.

Chapter 11, Bitmap and Sound

Today we are going back to Pygame to go over how to use bitmap images and sound.

Please download the following files for the tutorial, do not use any other files than the ones below:

http://10.3.30.107/resources/coding/saturn_family1.bmp

http://10.3.30.107/resources/coding/player.bmp

http://10.3.30.107/resources/coding/laser5.ogg

Since pygame only really accepts .BMP, we will go over how to convert image file format using Adobe Photoshop. And we will go over how to convert .MP3 or any audio to .OGG using:

http://audio.online-convert.com/convert-to-ogg

Follow along below:

http://programarcadegames.com/index.php?chapter=bitmapped_graphics_and_sound&lang=en#section_11

As usual, after the tutorial, please submit your file to the server when done.

Simple Caesar Cipher Python assignment

Your assignment is create a simple caesar cipher program in python. You will need to submit pseudocode along with the assignment, so please make sure you do not just copy code from somewhere because you will need to be able to write the pseudocode for your program as well. If you do not wish to write pseudocode, I will accept a Snap! program in addition to your python code.

Requirements:

  • Create a user menu that asks the user if they want to encrypt, decrypt, or quit (use the code from your dice roller game).
  • Must take user input for the phrase to be encrypted or decrypted
  • Must ask the user for a key that will be the shift for the caesar cipher to encrypt or decrypt
  • Do not encrypt or decrypt any non-alphabetic characters (eg. 123, ‘, ~, {…), leave them as they are. Check for uppercase characters and convert everything to lowercase.
  • After successful encryption/decryption, output the result and then go back to the menu to ask the user if they want to encrypt, decrypt, or quit.
  • You must use a python function for encrypt, and a separate python function for decrypt (go back to the website to see how to do functions).

Here are some hints for your assignment.

Define a variable called alphabet:

alphabet = ‘abcdefghijklmnopqrstuvwxyvz’

Get each letter, one at a time, and compare it to the variable alphabet above, to find the position of the letter in the alphabet (eg. ‘h’ would be alphabet[7]).

 

Then use the following algorithm (and a for loop) inside your encrypt and decrypt functions to find the cipher alphabet given a letter from the above string:

Encrypt (x) = (x + n) % 26
Decrypt (x) = (x – n) % 26

Or another way would be to create a shift_alpha variable that has all the letters shifted by the key (key = 3 in the eg. below), then look for shift_alpha[7]:

shift_alpha = ‘defghijklmnopqrstuvwxyzabc’

As usual, please submit your .py file along with your pseudocode document on the server when you are done. This assignment is due on Wed Apr 19.

Lecture Cryptography

Today we will be going over part 2 of the short lecture series on computer security which will be on cryptography. I will go over the Powerpoint below (you can download it to follow along on your computer).

pt2-cryptography

When the lecture is done, please copy/paste the following questions into a word processing doc (MS Word or Google Docs) and answer the the questions and save them on the server.

What is the process called that converts plaintext into ciphertext?
What is a cipher?

What is a ceasar cipher and how does it work?

What is the process called that decrypts a message without knowing the cipher or the key used to encrypt it?

Which key is used to decrypt the message?

Which key is distributed freely?

What is a digital signature used for?

Why do you think encryption is necessary?

Yes or No, Why do you think software companies should create backdoors for encryption to allow law enforcement to gain access to data for criminal investigations?

Video Activity on Stuxnet Virus

Today we will watch a video about the Stuxnet virus. It was a virus created by the US and Israeli Governments and up until now the most sophisticated virus ever written.

Copy/paste the questions and answers into a separate document:

What is an 0day (zero day) exploit?

How many 0days did Stuxnet have?

What is SCADA?

What is a PLC?

What was Stuxnet designed to do?

How exactly did Stuxnet work?

How did Stuxnet hide itself?

How was Stuxnet unstoppable?

What does it mean when a network is ‘air-gapped’?

How did Stuxnet jump the ‘air-gap’?

What happened to the Natanz nuclear facility?

Is the Stuxnet malicious code still a threat?

Here is the video: