BlackJack:
VARIABLES:
startFunds = 500; % start funds every game is $500
turn = used to determine if it’s the player or computer’s turn
funds = 500; % Total funds while the game continues through playthroughs.
leave = 1; % Used when the user wants to leave the game
playThrough = 0; % Increments when the player goes through another playthrough
intro = (‘Welcome to Blackjack!’); % Introduction
name = used to input the user’s name
inBid = used to have the user to input how much the would like to bid
leave = used to ask the user if they would like to leave
cardNames =used to hold the vector of card name aligned with values
cardValues = used to hold the vector of card values aligned with names
totalComp = total computer points
totalPlayer = total player points
randValue = used to randomize a specific card aligned with its name
compCard = the card drawn at a draw instance for computer
playerCard = the card drawn at a draw instance for player
changeAce = used to change the value of the ace card, sets it to compCard or playerCard
bust = used when the player points exceed 21
COMMANDS USED:
fprintf(); is used to print out variables and statements
input(); command prompts the user to input a numeric or string value to a variable
randperm(); randomizes the name and value arrays (but values are correctly matched with names)
Hangman
player1 = the person who will be entering the word
player2 = The person who will be guessing the word
word = the word player two will be guessing
starArray = the word with stars instead of letters
keepPlaying = boolean to determine if the program should keep asking the player for a letter
guesses = number of guesses player 2 has
pickedLetters = the letters player 2 has guesed
guess = the letter player 2 has picked
inWord = goes to one if the letter is in the word
Dice:
pot=Amount of money the player whats to play with
Bet= The amount money the player wants to bet out of their pot.
L= An string input for under, over, even
Under=1
even=2
over=3
roll=Randomly roll the two dice
total =The sum of the two dice.
while loops= determines if the pot value is at zero
fprintf= this displays if you won or lost and displays your money
randi= randomly roll the dice
switch= this allows the computer to sort three different inputs at once.