Started the assignment one for CS396
+- assignmentOne/wordcounter.cpp +- assignmentOne/maze.cpp +- assignmentOne/go_fish.cpp +- assignmentOne/battleship.cpp
This commit is contained in:
parent
8c738f9374
commit
c8b785fcb8
4 changed files with 180 additions and 0 deletions
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
Program Name: Battleship (Extra Credit Assignment)
|
||||
Process: Does the following according to spec:
|
||||
In this program, you will be recreating the game Battleship with a 5x5 gameboard grid and randomly
|
||||
placing 5 ships on the board
|
||||
Your game must do the following:
|
||||
● Every round, you must display two gameboards
|
||||
○ Target Gameboard
|
||||
■ This gameboard is to display the attempts the user has made against the
|
||||
computer.
|
||||
○ Ocean Gameboard
|
||||
■ This board is to display where the user has placed their ships and the computer’s
|
||||
attempts against the user.
|
||||
● Optional Key for the gameboard:
|
||||
○ X = Hit
|
||||
○ O = Miss
|
||||
○ + = One Ship
|
||||
○ . = Empty/Unknown territory.
|
||||
● The computer will place their ships randomly on their ocean gameboard grid meanwhile the user
|
||||
will be able to input where they want to place their ships by using coordinates.
|
||||
● Every round, the user will enter their coordinates and the program will display if it was a hit.
|
||||
After the user’s turn, the computer will state their coordinates and the program will display if it
|
||||
was a hit. After each round, the gameboard will display updated information.
|
||||
● The game is over when someone knocks down all of their opponent’s ships.
|
||||
Function Input/Parameters: ???
|
||||
Function Output/Parameters: ???
|
||||
Function Output/Returned: ???
|
||||
Device Input/Device: ???
|
||||
Device Output/Monitor: ???
|
||||
Dependencies: ???
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <time.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// function prototypes
|
||||
|
||||
// class definitions
|
||||
|
||||
// main program
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// return 0
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Program Name: Go Fish
|
||||
Process: Does the following according to spec:
|
||||
Players take turns asking their opponent for a specific card. The game will continue until all sets are
|
||||
collected.
|
||||
Here are the rules of the game:
|
||||
● Use a 52-card deck
|
||||
● Deal 7 cards to each player (human and computer).
|
||||
Each play will take turns asking for a card rank/number from the opponent. If the opponent has the card
|
||||
that is requested, they must hand over all the cards of that rank/number. If the opponent does not have the
|
||||
card requested, then the player number “go fish” meaning they must draw a card from the deck. If a
|
||||
player collects a set of four cards of the same rank, they will lay down the set and earn a point. The game
|
||||
will end when all sets have been collected.
|
||||
Function requirements:
|
||||
● humanTurn
|
||||
○ Handles the human’s turn. It will prompt the player to ask for a card rank/number and
|
||||
check if the computer has the requested rank/number. If the card is available in the
|
||||
computer’s hand, it will transfer the card to the human’s hand otherwise, it will draw a
|
||||
card. The function should return the number of sets collected during the turn
|
||||
● computerTurn
|
||||
○ Handles the computer’s turn and it should do the same actions as the human but for the
|
||||
computer. The function should return the number of set that is collected during its turn.
|
||||
Function Input/Parameters: ???
|
||||
Function Output/Parameters: ???
|
||||
Function Output/Returned: ???
|
||||
Device Input/Device: ???
|
||||
Device Output/Monitor: ???
|
||||
Dependencies: ???
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <time.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// function prototypes
|
||||
|
||||
// class definitions
|
||||
|
||||
// main program
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// return 0
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
Program Name: maze
|
||||
Process: Does the following according to spec:
|
||||
Develop a text-based maze game where the user will navigate through to
|
||||
find the exit. Your game will do the following:
|
||||
● Welcome the user to the Text Maze Game (or rename it something else)
|
||||
● Explain the goal to the user (leave the maze).
|
||||
● Create a 3x3 array that will represent the maze where each cell is a room.
|
||||
● Define the starting point and the exit point in the maze/array.
|
||||
● Prompt the user to move through the maze using “N” for north,
|
||||
“S” for south, “E” for east, and “W” for west.
|
||||
● Make sure the user can’t leave the boundary of the array.
|
||||
● Display a message that congratulates them for finding the exit.
|
||||
Function Input/Parameters: ???
|
||||
Function Output/Parameters: ???
|
||||
Function Output/Returned: ???
|
||||
Device Input/Device: ???
|
||||
Device Output/Monitor: ???
|
||||
Dependencies: ???
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <time.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// function prototypes
|
||||
|
||||
// class definitions
|
||||
|
||||
// main program
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// return 0
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
Program Name: Word Counter
|
||||
Process: asks how many sentences the user would like to input,
|
||||
counts the number of words within a sentence, using classes/objects
|
||||
prints out word count before exiting program.
|
||||
Function Input/Parameters: ???
|
||||
Function Output/Parameters: ???
|
||||
Function Output/Returned: ???
|
||||
Device Input/Device: ???
|
||||
Device Output/Monitor: ???
|
||||
Dependencies: ???
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <time.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// function prototypes
|
||||
|
||||
// class definitions
|
||||
|
||||
// main program
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// return 0
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue