by Roger Bourke White Jr., copyright June 2017
These are the in-class writing assignments for my CSIS 1340 Beginning Programming class.
Create a Tic Tac Toe algorhythm.
Here we go...
Tic Tac Toe
o Draw two horizontal lines and two vertical lines that will make nine "boxes" in a three-by-three arrangement. This is a "board".
o Decide who is going first. That person puts "X"'s in the boxes. The person who goes second puts "O"'s in the boxes.
o The X player starts and each goes in turn after that until all nine boxes are filled.
o The goal is to get three X's or three O's in a line -- either horizontally, vertically or diagonally. The first player to do that wins and that ends the game.
o If all nine boxes get filled and no one has three in a row then the game is a "Cat's game" -- a tie -- and the game ends with no winner.
o When the game ends draw a new board and start playing again until one or both players get tired of playing.
Chapter One discussion.
Here are some answers:
Chapter One Exercises
1. Convert a temperature from F to C.
o Input a temperature in F
o run it through the equation (F-32) * 5/9 = C
o Output a temperature in C
2. Add up the numbers from 1 to N.
o determine what N is
o input N numbers
o add the numbers
o output the sum
3. Given a person's last name determine if it appears in a list of names listed alphabetically.
o input the name
o determine the first letter
o check if there are names on the list with the same first letter
o those that are the same are matching
o if there are no matches output saying "no match" and end program
start a loop
o determine if there are more letters to match, if not jump out of loop
o determine the next letter
o check if there are names on the matching list which match the next letter
o if there are no matches output saying "no match" and end program
o if the name matches all the letters of a listed name and there are no more letters in the listed name output "match" and end program
o if no name on the list matches all the letters on the input name output saying "no match" and end program
end of the loop
4. Determine if a word is part of another word
o input the base word (root word)
o input the word to be checked (checked word)
o determine the first letter of the checked word
o see if that letter is in the root word, if not output "no" and end program
begin loop
o determine if there is another letter in the checked word. if there is not and the previous letters have all matched output "match" and end program
o if there is see if there is a match behind the previous letter in the root word. if there is not then output "no" and end program if there is then keep checking
end loop
5. Given N numbers one at a time determine the average of the numbers
o determine N that will be the number if inputs
o begin loop
o input the next number
o determine the average of the numbers already input and output that number
o when N is reached end the loop
o end loop
Introduce yourself to the class on Canvas.
I did some programming in high school and in the late 1970's when I was just getting into personal computers. I learned some BASIC on DOS-based machines and Pascal on Apple II's. I haven't done any since then so I'm real out-of-date and rusty.
A bit more background: I've been into computers since the 1970's, and have done some pioneering in this field. I started a web site back in 1996 and that's the best place to find out more about me.
"I'm Roger White and it's my world." [grin]
--The End--