Our website is a unique platform where students can share their papers in a matter of giving an example of the work to be done. If you find papers
matching your topic, you may use them only as an example of work. This is 100% legal. You may not submit downloaded papers as your own, that is cheating. Also you
should remember, that this work was alredy submitted once by a student who originally wrote it.
The paper "Analysis of Stone and Paper Game" tells us about program what enables the user to play the stone/paper/scissors game against the computer. When this game is played between two people, the players simultaneously choose one object (stone, paper, or scissors)…
Download full paperFile format: .doc, available for editing
Extract of sample "Analysis of Stone and Paper Game"
Analysis of Stone and Paper Game This program enables the user to play the stone/paper/scissors game against the computer. When this game is playedbetween two people, the players simultaneously choose one object (stone, paper, or scissors). After a count of three, the players make either a fist for a stone, a flat hand for paper, or a ’V’ with two fingers to represent scissors. There is then a matrix for deciding who wins that round:
-------- Player 1’s choices--------
Player1‘s choices
Player 2‘s choices
Stone
Paper
Scissors
Stone
Same choice; no one wins
Paper (player 1) wins because paper surrounds stone.
Stone (player 2) wins because stone smashes scissors.
Paper
Paper (player 2) wins because paper surrounds stone.
Same choice; no one wins
Scissors (player 1) wins because scissors cuts paper.
Scissors
Stone (player 1) wins because stone smashes scissors.
Scissors (player 2) wins because scissors cuts paper.
Same choice; no one wins
Main algorithm for the program:
while loop = ‘y’ do
prompt the user for how many rounds they want to play
initialize the variables sb1 and sb2 to 0 (counts number of wins)
for the number of rounds chosen,
prompt the user for their choice of paper/scissors/stone = ch
use the rand function to get a random number between 0-2
(for the computer’s choice of paper/scissors/stone; store in randomNo)
call function chk1 to find who wins
print the results of how many games were won (sb1 and sb2)
prompt user to play again (store in “loop” variable; if loop not equal to ‘y‘ or ‘Y‘ then while loop is finished)
end while loop
Algorithm for the function chk1:
if user chose paper (variable ch=1) then
if the computer chose paper (variable randomNo = 0) then
print statement that no one wins (since both made the same choice)
if the computer chose scissors (randomNo=1) then
print statement that computer wins since scissors cuts paper
change count of computer wins (increment variable “sb2”)
end if
if the computer chose stone (variable randomNo=2) then
print statement that the user wins since paper surrounds stone
change count of user wins (increment variable “sb1”)
end if
end if (ch=1)
if user chose scissors (variable ch=2) then
if the computer chose paper (variable randomNo = 0) then
print statement that the user wins since scissors cuts paper
change count of user wins (increment variable “sb1”)
end if
if the computer chose scissors (randomNo=1) then
print statement that no one wins (since both made the same choice)
if the computer chose stone (variable randomNo=2) then
print statement that the computer wins since stone smashes scissors
change count of computer wins (increment variable “sb2”)
end if
end if (ch=2)
if user chose stone (variable ch=3) then
if the computer chose paper (variable randomNo = 0) then
print statement that the computer wins since paper surrounds stone
change count of computer wins (increment variable “sb2”)
end if
if the computer chose scissors (randomNo=1) then
print statement that the user wins since stone smashes scissors
change count of user wins (increment variable “sb1”)
end if
if the computer chose stone (variable randomNo=2) then
print statement that no one wins (since both made the same choice)
end if (ch=3)
end function chk1
Flowcharts are as follows:
The data storage requirements are as follows: a variable must hold the user’s choice of paper/scissors/stone; another variable must hold the computer’s choice of paper/scissors/stone. If these three choices are represented as integers, then the variables can be integers called “ch” and “randomNo”.
Another integer can hold the number of times the user wants to play, this integer is called “roundsnomber”. Integers “sb1” and “sb2” can hold the number of times the user or computer wins.
The program detects if the player wants to continue play by reading a character from the keyboard, this is a type char variable called “loop”.
The function “chk1” handles the analysis of who wins, by using the logic of the matrix above. Function “chk1” goes over every possible case of combinations of choices that the user and computer may make. This way the main program is mainly free to handle input and output, and make the random choices of the computer.
Code for the program (first version) is as follows:
#include
#include
#include
#include
int randomNo;
int ch, sb1, sb2;
void chk1(void);
void main (void)
{
char loop=y;
int roundsnomber;
randomize();
printf("Welcome to the scissors, paper, stone game \n\n\n");
do
{
printf("How many rounds would you like to play for?");
scanf("%i", &roundsnomber);
printf("\n\nGame started....\n\n\n");
sb1=0;sb2=0;
for (int i = 1; i
Read
More
Share:
CHECK THESE SAMPLES OF Analysis of Stone and Paper Game
The thesis statement this paper would be holding is that artistic value of objects made before 1400 BC was not appreciated; they made artwork for functional reasons, their artistic elements came by default as modern day art experts discover them many generations later.... This paper investigates the political, cultural, historical and artistic context of The Stele of Hammurabi, to establish its presence in time and place in the kingdom; it further evaluates different approaches to the study of art in ancient times, before modern scholars developed art curriculum and content....
As if it were Christmas, little kids would happily gather stones; stuff them in their pockets and in the end, only to play the real game.... However, there could be several reasons why this game might have sustained over the course of time despite its deadly theme.... From Summer's tone here, it could be easily understood that the true colors of the tradition starts to show, especially when he asks to ‘get it over with;' projecting that no one is over the moon to stone someone....
The purpose of the lottery is not explicitly stated in the story though a more detailed analysis of the story would reveal that the lottery is done to ensure a good harvest the next year.... A lottery is a game of chance.... He is the one who prepares the slips of paper and he also brings the stool where the black box is placed....
A number of research studies reveal that analysis of these indecisive behaviors comes because of interactions.... For instance, online gaming brings out emotions of anger especially when one does not understand the set rules of the game.... Oftentimes, you find some gamers want something like a new hot game from a friend.... Thus, what happens is that, when the host is showing you the new game styles and the likes, you tend to throw insincere and baseless compliments just to make the host find it vital for you to get the new game (Sayre & King, 2009)....
Build upon the parameters of comparison regarding the areas like plot structure, characterization, setting , themes and purpose of the author, symbols, imagery style and tone, the essay shall probe into the transition of the thought processes and cultural backdrops from which the comparative analysis of these seminal works have evolved and operated.... When contrasting Shirley Jackson's short story “The Lottery” and the story “The Most Dangerous game” by Richard Connell are publications from different time frames, this particular understanding becomes quite apparent....
The sight of kids gathering stones "Bobby Martin had already stuffed his pockets full of stones, and the other boys soon followed his example, selecting the smoothest and roundest stones" and pilling them into stacks can be dissuaded as a juvenile act however the fact that the men of the village gather away from the stone might bear the seeds of early suspicion in a readers mind....
Therefore, the analysis of the fiction by Poe confirms that there is tremendous scope for a Freudian psychological interpretation of the various elements in most of his short stories.... The existing psychological studies seem not to cover the true extent of its possibility as a variety of criticisms and analysis of this nature focused on the psychological interpretation of the fiction mainly treating them as unconscious manifestation of the writer's own problems....
Therefore, a reflective analysis of the works by Shirley Jackson and Norman Cousin suggest that there are various similarities between the works, although they are concerned with different themes and plot.... "analysis of "The Lottery", a Short Story by Shirley Jackson.... Whereas Cousins' essay "Who killed Benny Paret" focuses on the cause and effect of a game, Shirley Jackson's "The Lottery" describes an event through the medium of short story....
2 Pages(500 words)Book Report/Review
sponsored ads
Save Your Time for More Important Things
Let us write or edit the assignment on your topic
"Analysis of Stone and Paper Game"
with a personal 20% discount.