C. Program Description for Developers

Othello

Variables:

Othelo % the matrix representtation of the othello board
this is true for all instances even within function

Othelo_test % the matrix representation of the othelo board surrounded by empty slots (0`s) used for testing purposes if move legal etc
this is true for all instances even within function

player % the player currently playing switches to winner at end of program

legal % true or false if the move is legal

x % the x coordinate
this is true for all instances even within function
y % the y coordinate
this is true for all instances even within function

i % i is a for loop iterator
j % j is a for loop iterator

small_Othelo % the othello board in this function

BEEG_Othelo % larger board used for testing etc

playerNum & the player currently playing

proper % true or false if the move is legal

Big_othelo % larger testing board same as othello test
this is true for all instances of Big_othello

Othelo_works % returns the larger testing board to othelo_test

Prow % is the row on the larger board that is passed through the check functions
this is true for all instances of Prow

Pcol % is the col on the larger board that in passed through the check functions
this is true for all instances of Pcol

row % row is the row that the function is checking in various check function
this is true for all instances of row

col % col is the collumn that the function is checking in various check functions
this is true for all instances of row

flip % determines whether or not to flip pieces in a check function

Othelo % Othelo is the returned larer othello board for tedsting
this is true for all instances of Othelo

newOthelo % updates the smaller board based on the larger testing board

GameOver % true or false if the game is over

count1 % the number of pices player one has
count2 % the number of pieces player two has

Board % is the matrix representing othelo game board that is passed through

player % is the player playing

______________________________________________________________________________
Functions:
function [x,y] = location(play)
% gets the location the player wants to play
play is the player within the funciton
function [proper,x,y] = is_legal(small_Othelo,BEEG_Othelo,x,y,playerNum)
%% is_legal determines if a legal move is made
function [Othelo,Othelo_test] = resetBoard()
%% sets the board ti the standard pre-game position
function [Othelo_works] = checkMoves(Big_othelo,y,x)
%% Check moves calls the the check: up down left etc function to
initiate changes to the board from capturing pices
function [Othelo] = checkUp(Big_othelo ,Prow , Pcol)
%% check the up switches
function [Othelo] = checkDown(Big_othelo ,Prow , Pcol)
%% check the down switches
function [Othelo] = checkLeft(Big_othelo ,Prow , Pcol)
%% check the left switches
function [Othelo] = checkRight(Big_othelo ,Prow , Pcol)
%% check the right switches
function [Othelo] = checkUpRight(Big_othelo ,Prow , Pcol)
%% check the up right switches
function [Othelo] = checkUpLeft(Big_othelo ,Prow , Pcol)
%% check the up left switches
function [Othelo] = checkDownLeft(Big_othelo ,Prow , Pcol)
%% check the down left switches
function [Othelo] = checkDownRight(Big_othelo ,Prow , Pcol)
%% check the down Right switches
function [newOthelo] = update(Othelo
%% update updates the othelo board based on the othelo test
function [GameOver, player] = endGame(Board, playerNum)
%% endGame determines if the game is over and if so who the winner is

Hangman

Variables:

  1. words: Used to import data from the text file that contains the word bank.
  2. spaces: Takes the length of word chosen randomly from the word bank.
  3. pos: Indicates the position of the words.
  4. guess: Stores the random word chosen from the word bank
  5. l: Takes the length of the random word
  6. i: Variable to set the conditions of the for loop
  7. list: Used to display the random word chosen by stars
  8. t: Represents the number of incorrect guesses by the player
  9. j: Variable to set the conditions of the for loop
  10. t1: Used to store the letters guessed by the player in previous turns
  11. guess1: Used to display all used letters by the player in previous turns
  12. sum: Used to calculate if letter guessed is in the random word chosen
  13. t2: Used to find the number of stars or unguessed letters left
  14. a: Used to make the game board bottom line
  15. b: Used to make the game board bottom line
  16. c: Used to make the game board vertical line
  17. d: Used to make the game board vertical line
  18. e: Used to make the game board top beam
  19. f: Used to make the game board top beam
  20. g: Used to make the hangman’s noose
  21. h: Used to make the hangman’s noose
  22. xc: Variable used to make the head, torso and arms
  23. yc: Variable used to make the head, torso and arms
  24. r: Variable used to make the head, torso and arms

 

Functions:

  1. Gameboard: this function is used to create the game board for hangman, with the body parts of the man slowly getting filled as the player makes more incorrect guesses.