|
Subject: Comp. Sci. & Game Prog. |
|
1. Topic-
|
Binary Math and Computer Colors |
|
|
2. Content-
|
Binary Math
Microsoft XNA game programming |
|
|
3. Goals: Aims/Outcomes-
|
1. Students learn how to count in binary
2. Students learn about the byte variable declaration when programming
a computer
3. Students learn how to declare and use a byte variable for colors
in an XNA game |
|
|
4. Objectives-
|
1. Illustrate how binary works
2. Talk about byte variable declarations
3. Program XNA to accept color settings using a series of three byte
variables |
|
|
5. Materials and Aids-
|
Board with eight light switches mounted on it
Computers with XNA loaded on them
Smartboard |
|
|
6. Procedures/Methods-
|
A. Introduction-
1. Computers really only understand ones and zeros
2. In order to give instructions to computers we must understand binary
3. Programming binary requires the use of byte variables |
|
|
B. Development-
1. Light switches somewhat match the idea of transistors in a computer
- eight light switches in a row represent eight bits in a byte
2. By flipping different switches on or off and adding up the values
each of them have, we can use math to set values to each byte
3. Because computers use a three byte color system for a total of
~16.5 million colors, three byte variables, one each for red, green
and blue will allow us to accomplish this goal. |
|
|
C. Practice-
1.Some students demonstrate setting the light switches and converting
to binary
2. All students declare and initialize byte variables in Microsoft
XNA and then set the game screen's color using these variables
3. Students are given a practice quiz at the end of the lesson |
|
|
D. Independent Practice-
Students are asked to modify the byte variable initializations to
see if they can get different colors out of the system |
|
|
E. Accommodations (Differentiated Instruction)-
1. One-on-one work, teacher with student, is required for students
who have compilation errors and need debugging help.
2. Some students need extra practice time with binary and that is
granted. One-on-one student to teacher help is also provided. |
|
|
F. Checking for understanding-
1. Students are given a practice quiz at the end of the lesson to
check for their understanding of binary
2. Formative assessments during the lessons |
|
|
G. Closure-
Students wrap up by completing their coding and successfully debugging
and compiling the game. |
|
|
7. Evaluation-
|
1.Students are successful if they can develop any number between
0 and 255 using 8-bit byte binary
2. Students are successful if they recognize that three 8-bit bytes
taken together actually represents an exponential function (255 cubed)
which allows us to arrive at the millions of colors we can derive
out of an RGB system.
3. Students are successful if they can successfully debug and compile
their game code, and if they can modify it so that it has a different
color.
4. Students are successful if they recognize that the RGB color coding
system consists of three 8-bit bytes that are taken together to come
up with different colors. |
|
|
8. Teacher Reflection-
|
For students who have a relatively high computer science aptitude
binary isn't much of a struggle. I think it helps to picture a physical
manifestation of what's really going on at the byte level, so the
light switches work well.
The most difficulty I had with this lesson was in getting students
to understand the idea that three bytes taken together as one entity
work exponentially. That idea was lost on some students and required
further clarification on my part.
For most students, compilation errors generally occurred when there
was a misspelling or a missing semicolon on statements. For the most
part, most students understand and comprehend what they're doing when
they declare and initialize byte variables and use them in their code
to modify game screen colors. |
|
|