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:
- words: Used to import data from the text file that contains the word bank.
- spaces: Takes the length of word chosen randomly from the word bank.
- pos: Indicates the position of the words.
- guess: Stores the random word chosen from the word bank
- l: Takes the length of the random word
- i: Variable to set the conditions of the for loop
- list: Used to display the random word chosen by stars
- t: Represents the number of incorrect guesses by the player
- j: Variable to set the conditions of the for loop
- t1: Used to store the letters guessed by the player in previous turns
- guess1: Used to display all used letters by the player in previous turns
- sum: Used to calculate if letter guessed is in the random word chosen
- t2: Used to find the number of stars or unguessed letters left
- a: Used to make the game board bottom line
- b: Used to make the game board bottom line
- c: Used to make the game board vertical line
- d: Used to make the game board vertical line
- e: Used to make the game board top beam
- f: Used to make the game board top beam
- g: Used to make the hangman’s noose
- h: Used to make the hangman’s noose
- xc: Variable used to make the head, torso and arms
- yc: Variable used to make the head, torso and arms
- r: Variable used to make the head, torso and arms
Functions:
- 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.