Programming Assignment 7: Poker (5-Card Draw) II. Prerequisites: Before starting this programming assignment, participants should be able to: Apply and implement pointers in C Pass output parameters to functions Analyze a basic set of requirements and apply top-down design principles for a problem Apply repetition structures within an algorithm Construct while (), for (), or do-while () loops in C Compose C programs consisting of sequential, conditional, and iterative statements Eliminate redundancy within a program by applying loops and functions Create structure charts for a given problem Open and close files Read, write to, and update files Manipulate file handles Apply standard library functions: fopen (), fclose (), fscanf (), and fprintf () Apply and implement pointers 2-dimenional arrays Define and apply structs in C Compose decision statements (“if” conditional statements) Create and utilize compound conditions Summarize topics from Hanly & Koffman Chapter 8 including: What is an array? Distinguishing between single dimensional and 2-dimentional arrays What is an index? III. Overview & Requirements: Write a program that allows a user to play 5-Card-Draw Poker against the computer. Start with the following example code supplied by Deitel & Deitel (example code). This will help you get started with the game of Poker. Please read this site to learn the rules of Poker http://en.wikipedia.org/wiki/5_card_draw. Complete the following step and you will have a working Poker game!!! Adapted from Deitel & Deitel’s C How to Program (6th Edition): (1) In order to complete the game of 5-card-draw poker, you should complete the following functions: (a) (5 pts) Modify the card dealing function provided in the example code so that a five-card poker hand is dealt. (b) (5 pts) Write a function to determine if the hand contains a pair. (c) (5 pts) Write a function to determine if the hand contains two pairs. (d) (5 pts) Write a function to determine if the hand contains three of a kind (e.g. three jacks). (e) (5 pts) Write a function to determine if the hand contains four of a kind (e.g. four aces). (f) (5 pts) Write a function to determine if the hand contains a flush (i.e. all five cards of the same suit). (g) (5 pts) Write a function to determine if the hand contains a straight (i.e. five cards of consecutive face values). (2) (20 pts) Use the functions developed in (1) to deal two five-card poker hands, evaluate each hand, and determine which is the better hand. (3) (25 pts) Simulate the dealer. The dealer’s five-card hand is dealt “face down” so the player cannot see it. The program should then evaluate the dealer’s hand, and based on the quality of the hand, the dealer should draw one, two, or three more cards to replace the corresponding number of unneeded cards in the original hand. The program should then re-evaluate the dealer’s hand. (4) (10 pts) Make the program handle the dealer’s five-card hand automatically. The player should be allowed to decide which cards of the player’s hand to replace. The program should then evaluate both hands and determine who wins. Now use the program to play 10 games against the computer. You should be able to test and modify or refine your Poker game based on these results!

Programming Assignment 7: Poker (5-Card Draw) II. Prerequisites: Before starting this programming assignment, participants should be able to: Apply and implement pointers in C Pass output parameters to functions Analyze a basic set of requirements and apply top-down design principles for a problem Apply repetition structures within an algorithm Construct while (), for (), or do-while () loops in C Compose C programs consisting of sequential, conditional, and iterative statements Eliminate redundancy within a program by applying loops and functions Create structure charts for a given problem Open and close files Read, write to, and update files Manipulate file handles Apply standard library functions: fopen (), fclose (), fscanf (), and fprintf () Apply and implement pointers 2-dimenional arrays Define and apply structs in C Compose decision statements (“if” conditional statements) Create and utilize compound conditions Summarize topics from Hanly & Koffman Chapter 8 including: What is an array? Distinguishing between single dimensional and 2-dimentional arrays What is an index? III. Overview & Requirements: Write a program that allows a user to play 5-Card-Draw Poker against the computer. Start with the following example code supplied by Deitel & Deitel (example code). This will help you get started with the game of Poker. Please read this site to learn the rules of Poker http://en.wikipedia.org/wiki/5_card_draw. Complete the following step and you will have a working Poker game!!! Adapted from Deitel & Deitel’s C How to Program (6th Edition): (1) In order to complete the game of 5-card-draw poker, you should complete the following functions: (a) (5 pts) Modify the card dealing function provided in the example code so that a five-card poker hand is dealt. (b) (5 pts) Write a function to determine if the hand contains a pair. (c) (5 pts) Write a function to determine if the hand contains two pairs. (d) (5 pts) Write a function to determine if the hand contains three of a kind (e.g. three jacks). (e) (5 pts) Write a function to determine if the hand contains four of a kind (e.g. four aces). (f) (5 pts) Write a function to determine if the hand contains a flush (i.e. all five cards of the same suit). (g) (5 pts) Write a function to determine if the hand contains a straight (i.e. five cards of consecutive face values). (2) (20 pts) Use the functions developed in (1) to deal two five-card poker hands, evaluate each hand, and determine which is the better hand. (3) (25 pts) Simulate the dealer. The dealer’s five-card hand is dealt “face down” so the player cannot see it. The program should then evaluate the dealer’s hand, and based on the quality of the hand, the dealer should draw one, two, or three more cards to replace the corresponding number of unneeded cards in the original hand. The program should then re-evaluate the dealer’s hand. (4) (10 pts) Make the program handle the dealer’s five-card hand automatically. The player should be allowed to decide which cards of the player’s hand to replace. The program should then evaluate both hands and determine who wins. Now use the program to play 10 games against the computer. You should be able to test and modify or refine your Poker game based on these results!

checkyourstudy.com Whatsapp +919911743277
1-Two notions serve as the basis for all torts: wrongs and compensation. True False 2-The goal of tort law is to put a defendant in the position that he or she would have been in had the tort occurred to the defendant. True False 3-Hayley is injured in an accident precipitated by Isolde. Hayley files a tort action against Isolde, seeking to recover for the damage suffered. Damages that are intended to compensate or reimburse a plaintiff for actual losses are: compensatory damages. reimbursement damages. actual damages. punitive damages. 4-Ladd throws a rock intending to hit Minh but misses and hits Nasir instead. On the basis of the tort of battery, Nasir can sue: Ladd. Minh. the rightful owner of the rock. no one. 4-Luella trespasses on Merchandise Mart’s property. Through the use of reasonable force, Merchandise Mart’s security guard detains Luella until the police arrive. Merchandise Mart is liable for: assault. battery. false imprisonment. none of the choice 6-The extreme risk of an activity is a defense against imposing strict liability. True False 7-Misrepresentation in an ad is enough to show an intent to induce the reliance of anyone who may use the product. True False 8-Luke is playing a video game on a defective disk that melts in his game player, starting a fire that injures his hands. Luke files a suit against Mystic Maze, Inc., the game’s maker under the doctrine of strict liability. A significant application of this doctrine is in the area of: cyber torts. intentional torts. product liability. unintentional torts 9-More than two hundred years ago, the Declaration of Independence recognized the importance of protecting creative works. True False 10-n 2014, Cloud Computing Corporation registers its trademark as provided by federal law. After the first renewal, this registration: is renewable every ten years. is renewable every twenty years. runs for life of the corporation plus seventy years. runs forever. 11-Wendy works as a weather announcer for a TV station under the character name Weather Wendy. Wendy can register her character’s name as: a certification mark. a trade name. a service mark. none of the choices 12-Much of the material on the Internet, including software and database information, is not copyrighted. True False 13-In a criminal case, the state must prove its case by a preponderance of the evidence. True False 14-Under the Fourth Amendmentt, general searches through a person’s belongings are permissible. True False 15-Maura enters a gas station and points a gun at the clerk Nate. She then forces Nate to open the cash register and give her all the money. Maura can be charged with: burglary. robbery. larceny. receiving stolen property. 16-Reno, driving while intoxicated, causes a car accident that results in the death of Santo. Reno is arrested and charged with a felony. A felony is a crime punishable by death or imprisonment for: any period of time. more than one year. more than six months. more than ten days. 17-Corporate officers and directors may be held criminally liable for the actions of employees under their supervision. True False 18-Sal assures Tom that she will deliver a truckload of hay to his cattle ranch. A person’s declaration to do a certain act is part of the definition of: an expectation. a moral obligation. a prediction. a promise. 19-Lark promises to buy Mac’s used textbook for $60. Lark is: an offeror. an offeree a promisee. a promisor. 20-Casey offers to sell a certain used forklift to DIY Lumber Outlet, but Casey dies before DIY accepts. Most likely, Casey’s death: did not affect the offer. shortened the time of the offer but did not terminated it. extended the time of the offer. terminated the offer.

1-Two notions serve as the basis for all torts: wrongs and compensation. True False 2-The goal of tort law is to put a defendant in the position that he or she would have been in had the tort occurred to the defendant. True False 3-Hayley is injured in an accident precipitated by Isolde. Hayley files a tort action against Isolde, seeking to recover for the damage suffered. Damages that are intended to compensate or reimburse a plaintiff for actual losses are: compensatory damages. reimbursement damages. actual damages. punitive damages. 4-Ladd throws a rock intending to hit Minh but misses and hits Nasir instead. On the basis of the tort of battery, Nasir can sue: Ladd. Minh. the rightful owner of the rock. no one. 4-Luella trespasses on Merchandise Mart’s property. Through the use of reasonable force, Merchandise Mart’s security guard detains Luella until the police arrive. Merchandise Mart is liable for: assault. battery. false imprisonment. none of the choice 6-The extreme risk of an activity is a defense against imposing strict liability. True False 7-Misrepresentation in an ad is enough to show an intent to induce the reliance of anyone who may use the product. True False 8-Luke is playing a video game on a defective disk that melts in his game player, starting a fire that injures his hands. Luke files a suit against Mystic Maze, Inc., the game’s maker under the doctrine of strict liability. A significant application of this doctrine is in the area of: cyber torts. intentional torts. product liability. unintentional torts 9-More than two hundred years ago, the Declaration of Independence recognized the importance of protecting creative works. True False 10-n 2014, Cloud Computing Corporation registers its trademark as provided by federal law. After the first renewal, this registration: is renewable every ten years. is renewable every twenty years. runs for life of the corporation plus seventy years. runs forever. 11-Wendy works as a weather announcer for a TV station under the character name Weather Wendy. Wendy can register her character’s name as: a certification mark. a trade name. a service mark. none of the choices 12-Much of the material on the Internet, including software and database information, is not copyrighted. True False 13-In a criminal case, the state must prove its case by a preponderance of the evidence. True False 14-Under the Fourth Amendmentt, general searches through a person’s belongings are permissible. True False 15-Maura enters a gas station and points a gun at the clerk Nate. She then forces Nate to open the cash register and give her all the money. Maura can be charged with: burglary. robbery. larceny. receiving stolen property. 16-Reno, driving while intoxicated, causes a car accident that results in the death of Santo. Reno is arrested and charged with a felony. A felony is a crime punishable by death or imprisonment for: any period of time. more than one year. more than six months. more than ten days. 17-Corporate officers and directors may be held criminally liable for the actions of employees under their supervision. True False 18-Sal assures Tom that she will deliver a truckload of hay to his cattle ranch. A person’s declaration to do a certain act is part of the definition of: an expectation. a moral obligation. a prediction. a promise. 19-Lark promises to buy Mac’s used textbook for $60. Lark is: an offeror. an offeree a promisee. a promisor. 20-Casey offers to sell a certain used forklift to DIY Lumber Outlet, but Casey dies before DIY accepts. Most likely, Casey’s death: did not affect the offer. shortened the time of the offer but did not terminated it. extended the time of the offer. terminated the offer.

1-Two notions serve as the basis for all torts: wrongs … Read More...
– 1 – Fall 2015 EECS 338 Assignment 2 Due: Oct. 1st, 2015 G. Ozsoyoglu Concurrent Programming with Semaphores; 140 points (100 pts) 1. Priority-based Searchers/Inserters/Deleters Problem without starvation. Three types of processes, namely, searchers, inserters, and deleters share access to a singly linked list L, and perform search, insert, or delete operations, respectively. The list L does not have duplicate values. a) Searchers merely search the list L, and report success (i.e., item searched is in L) or no-success (i.e., item searched is not in L) to a log file. Hence they can execute concurrently with each other. b) Inserters add new items to the end of the list L, and report success (i.e., item is not in L, and successfully inserted into L) or no-success (i.e., item is already in L, and no insertion takes place) to a log file. Insertions must be mutually exclusive to preclude two inserters from inserting new items at about the same time. However, one insert can proceed in parallel with any number of searches. c) Deleters remove items from anywhere in the list, and report success (i.e., the item is found in L and deleted) or no-success (i.e., item is not in L, and could not be deleted) to a log file. At most one deleter can access the list L at a time, and the deletion must be mutually exclusive with searches and insertions. d) Initial start. Searcher, inserter, and deleter processes are initially launched as follows. A user process that needs a search/insertion/deletion operation to the list L first forks a process, and then, in the forked process, performs an execv into a searcher/ inserter/deleter process. e) Log maintenance. Upon start, each searcher/inserter/deleter writes to a log file, recording the time of insertion, process id, process type (i.e., searcher, inserter, or deleter), and the item that is being searched/inserted/deleted. f) Termination. Upon successful or unsuccessful completion, each searcher/inserter/deleter writes to the same log file, recording the time and the result of its execution. g) Priority-based service between three types. Searchers, inserters, and deleters perform their search, insert, delete operations, respectively, on a priority basis (not on a first-come-first-serve (FCFS) basis) between separate process types (i.e., searchers, inserters, deleters) as follows. Searchers search with the highest priority; inserters insert with the second highest priority (except that one inserter can proceed in parallel with any number of searchers), and deleters delete with the lowest priority. h) FCFS service within a single type. Processes of the same type are serviced FCFS. As an example, among multiple inserters, the order of insertions into L is FCFS. Similarly, among multiple deleters, the order of deletions into L is FCFS. Note that, among searchers, while the start of search among searchers is FCFS, due to concurrent searcher execution, the completions of multiple searchers may not be FCFS. i) Starvation avoidance. In addition to the above priority-based search/insert/delete operations, the following starvation-avoidance rule is enforced. o After 10 consecutive searchers search the list L, if there is at least one waiting inserter or deleter then newly arriving searchers are blocked until (a) all waiting inserters are first serviced FCFS, and, then (b) all waiting deleters are serviced FCFS. Then, both the standard priority-based service between process types and the FCFS service within a process type resume. You are to specify a semaphore-based algorithm to synchronize searcher, inserter and deleter processes. Note:  Explain your algorithm.  Make sure to state any assumptions you make in your solution.  Specify the initial states of your variables and semaphores.  Specify whether your semaphores are binary or nonbinary.  Do not bother specifying algorithms for sequential tasks: simply specify a well-defined function/procedure (i.e., one with well-defined input/output/functional specification). – 2 – (40 pts) 2. Four-of-a-Kind Problem is defined as follows.  There is a deck of 24 cards, split into 6 different kinds, 4 cards of each kind.  There are 4 players (i.e., processes) ??,0≤?≤3; each player can hold 4 cards.  Between each pair of adjacent (i.e., seated next to each other) players, there is a pile of cards.  The game begins by o someone dealing four cards to each player, and putting two cards on the pile between each pair of adjacent players, and o ?0 starting the game. If ?0 has four-of-a-kind, ?0 wins. Whoever gets four-of-a-kind first wins.  Players take turns to play clockwise. That is, ?0 plays, ?1 plays, ?2 plays, ?3 plays, ?0 plays, etc.  Each player behaves as follows. o So long as no one has won, keep playing. o If it is my turn and no one has won:  Check for Four-of-a-Kind. If yes, claim victory. Otherwise discard a card into the pile on the right; pick up a card from the pile on the left; and, check again: If Four-of-a-Kind, claim victory; otherwise revise turn so that the next player plays and wait for your turn.  There are no ties; when a player has claimed victory, all other players stop (when their turns to play come up). You are to specify a semaphore-based algorithm to the Four-of-a-Kind problem. Note:  Explain your algorithm.  Make sure to state any assumptions you make in your solution.  Specify the initial states of your variables and semaphores.  Specify whether your semaphores are binary or nonbinary.  Do not bother specifying algorithms for sequential tasks: simply specify a well-defined function/procedure (i.e., one with well-defined input/output/functional specification). P1 P0 P2 P3 pile 1 pile 2 pile 3 pile 0

– 1 – Fall 2015 EECS 338 Assignment 2 Due: Oct. 1st, 2015 G. Ozsoyoglu Concurrent Programming with Semaphores; 140 points (100 pts) 1. Priority-based Searchers/Inserters/Deleters Problem without starvation. Three types of processes, namely, searchers, inserters, and deleters share access to a singly linked list L, and perform search, insert, or delete operations, respectively. The list L does not have duplicate values. a) Searchers merely search the list L, and report success (i.e., item searched is in L) or no-success (i.e., item searched is not in L) to a log file. Hence they can execute concurrently with each other. b) Inserters add new items to the end of the list L, and report success (i.e., item is not in L, and successfully inserted into L) or no-success (i.e., item is already in L, and no insertion takes place) to a log file. Insertions must be mutually exclusive to preclude two inserters from inserting new items at about the same time. However, one insert can proceed in parallel with any number of searches. c) Deleters remove items from anywhere in the list, and report success (i.e., the item is found in L and deleted) or no-success (i.e., item is not in L, and could not be deleted) to a log file. At most one deleter can access the list L at a time, and the deletion must be mutually exclusive with searches and insertions. d) Initial start. Searcher, inserter, and deleter processes are initially launched as follows. A user process that needs a search/insertion/deletion operation to the list L first forks a process, and then, in the forked process, performs an execv into a searcher/ inserter/deleter process. e) Log maintenance. Upon start, each searcher/inserter/deleter writes to a log file, recording the time of insertion, process id, process type (i.e., searcher, inserter, or deleter), and the item that is being searched/inserted/deleted. f) Termination. Upon successful or unsuccessful completion, each searcher/inserter/deleter writes to the same log file, recording the time and the result of its execution. g) Priority-based service between three types. Searchers, inserters, and deleters perform their search, insert, delete operations, respectively, on a priority basis (not on a first-come-first-serve (FCFS) basis) between separate process types (i.e., searchers, inserters, deleters) as follows. Searchers search with the highest priority; inserters insert with the second highest priority (except that one inserter can proceed in parallel with any number of searchers), and deleters delete with the lowest priority. h) FCFS service within a single type. Processes of the same type are serviced FCFS. As an example, among multiple inserters, the order of insertions into L is FCFS. Similarly, among multiple deleters, the order of deletions into L is FCFS. Note that, among searchers, while the start of search among searchers is FCFS, due to concurrent searcher execution, the completions of multiple searchers may not be FCFS. i) Starvation avoidance. In addition to the above priority-based search/insert/delete operations, the following starvation-avoidance rule is enforced. o After 10 consecutive searchers search the list L, if there is at least one waiting inserter or deleter then newly arriving searchers are blocked until (a) all waiting inserters are first serviced FCFS, and, then (b) all waiting deleters are serviced FCFS. Then, both the standard priority-based service between process types and the FCFS service within a process type resume. You are to specify a semaphore-based algorithm to synchronize searcher, inserter and deleter processes. Note:  Explain your algorithm.  Make sure to state any assumptions you make in your solution.  Specify the initial states of your variables and semaphores.  Specify whether your semaphores are binary or nonbinary.  Do not bother specifying algorithms for sequential tasks: simply specify a well-defined function/procedure (i.e., one with well-defined input/output/functional specification). – 2 – (40 pts) 2. Four-of-a-Kind Problem is defined as follows.  There is a deck of 24 cards, split into 6 different kinds, 4 cards of each kind.  There are 4 players (i.e., processes) ??,0≤?≤3; each player can hold 4 cards.  Between each pair of adjacent (i.e., seated next to each other) players, there is a pile of cards.  The game begins by o someone dealing four cards to each player, and putting two cards on the pile between each pair of adjacent players, and o ?0 starting the game. If ?0 has four-of-a-kind, ?0 wins. Whoever gets four-of-a-kind first wins.  Players take turns to play clockwise. That is, ?0 plays, ?1 plays, ?2 plays, ?3 plays, ?0 plays, etc.  Each player behaves as follows. o So long as no one has won, keep playing. o If it is my turn and no one has won:  Check for Four-of-a-Kind. If yes, claim victory. Otherwise discard a card into the pile on the right; pick up a card from the pile on the left; and, check again: If Four-of-a-Kind, claim victory; otherwise revise turn so that the next player plays and wait for your turn.  There are no ties; when a player has claimed victory, all other players stop (when their turns to play come up). You are to specify a semaphore-based algorithm to the Four-of-a-Kind problem. Note:  Explain your algorithm.  Make sure to state any assumptions you make in your solution.  Specify the initial states of your variables and semaphores.  Specify whether your semaphores are binary or nonbinary.  Do not bother specifying algorithms for sequential tasks: simply specify a well-defined function/procedure (i.e., one with well-defined input/output/functional specification). P1 P0 P2 P3 pile 1 pile 2 pile 3 pile 0

– 1 – Fall 2015 EECS 338 Assignment 2 Due: … Read More...
The Agawam High School band is playing some lively marches while the coaches are giving pep talks to their respective football squads. Although it is September, it is unseasonably hot (88°F/31°C) and the band uniforms are wool. Suddenly, Harry the tuba player becomes light-headed and faints. Explain his fainting in terms of vascular events

The Agawam High School band is playing some lively marches while the coaches are giving pep talks to their respective football squads. Although it is September, it is unseasonably hot (88°F/31°C) and the band uniforms are wool. Suddenly, Harry the tuba player becomes light-headed and faints. Explain his fainting in terms of vascular events

Harry’s condition suggests that this is a case of transient … Read More...
The life span of a DVD player produced by a one major company is known to be normally distributed with a mean of 6.2 years. If 4.01% of these DVD players have a life span of more than 8 years, what is the standard deviation of thee DVD player’s life span ?

The life span of a DVD player produced by a one major company is known to be normally distributed with a mean of 6.2 years. If 4.01% of these DVD players have a life span of more than 8 years, what is the standard deviation of thee DVD player’s life span ?

We need to find the z score first. The z … Read More...
Project Part 1 Objective Our objective, in this Part 1 of our Project, is to practise solving a problem by composing and testing a Python program using all that we have learnt so far and discovering new things, such as lists of lists, on the way. Project – Hunting worms in our garden! No more turtles! In this project, we shall move on to worms. Indeed, our project is a game in which the player hunts for worms in our garden. Once our garden has been displayed, the player tries to guess where the worms are located by entering the coordinates of a cell in our garden. When the player has located all the worms, the game is over! Of course there are ways of making this game more exciting (hence complicated), but considering that we have 2 weeks for Part 1 and 2 weeks for Part 2, keeping it simple will be our goal. We will implement our game in two parts. In Part 1, we write code that constructs and tests our data structures i.e., our variables. In Part 2, we write code that allows the player to play a complete “worm hunting” game! ? Project – Part 1 – Description Data Structures (variables): As stated above, in Part 1, we write code that constructs our data structures i.e., our variables. In our game program, we will need data structures (variables) to represent: 1. Our garden that is displayed to the player (suggestion: list of lists), 2. The garden that contains all the worms (suggestion: another list of lists), Garden: Our garden in Part 1 of our Project will have a width and a height of 10. Warning: The width and the height of our garden may change in Part 2 of our Project. So, it may be a good idea to create 2 variables and assign the width and the height of our garden to these 2 variables. 3. Our worms and their information. For each worm, we may want to keep the following information: a. worm number, b. the location of the worm, for example, either the coordinates of the cells containing the worm OR the coordinate of the first cell containing the worm, its length and whether the worm is laying horizontally or vertically. Worms: We will create 6 worms of length 3. 4. And other variables as needed. Testing our data structures: ? Suggestion: as we create a data structure (the “displayed” garden, the garden containing the worms, each worm, etc…), print it with a “debug print statement”. Once we are certain the data structure is well constructed, comment out the “debug print statement”. Code: In Part 1, the code we write must include functions and it must include the main section of our program. In other words, in Part 1, the code we write must be a complete program. In terms of functions, here is a list of suggestions. We may have functions that … ? creates a garden (i.e., a garden data structure), ? creates the worms (i.e., the worm data structure), ? places a worm in the garden that is to hold the worms (i.e., another garden data structure), ? displays the garden on the screen for the player to see, ? displays a worm in the displayed garden, ? etc… ? Finally, in Part 1, the code we write must implement the following algorithm: Algorithm: Here is the algorithm for the main section of our game program: ? Welcome the player ? Create an empty “displayed” garden, (“displayed” because this is the garden we display to the player) ? Create the worms (worms’ information) ? Create an empty “hidden” garden Note 1: “hidden” because one can keep track of the worms in this “hidden” garden, which we do not show to the player. This is why it is called “hidden”. Note 2: One can keep track of worm’s locations using a different mechanism or data structure. It does not have to be a list of lists representing a “hidden” garden. We are free to choose how we want to keep track of where our worms are located in our garden. ? Place each worm in the “hidden” garden (or whatever mechanism or data structure we decide to use) ? Display the “displayed” garden on the screen for the player to see ? While the player wants to play, ask the player for a worm number (1 to 6), read this worm number and display this worm on the “displayed” garden. This is not the game. Remember, we shall implement the game itself in Part 2. Here, in this step, we make sure our code works properly, i.e., it can retrieve worm information and display worms properly. Displaying worms properly: Note that when we create worms and display them, it may be the case that worms overlap with other worms and that worms wrap around the garden. These 2 situations are illustrated in the 3 Sample Runs discussed below. At this point, we are ready for Part 2 of our Project. Sample Runs: In order to illustrate the explanations given above of what we are to do in this Part 1 of our Project, 3 sample runs have been posted below the description of this Part 1 of our Project on our course web site. Have a look at these 3 sample runs. The code we create for this Part 1 of our Project must produce exactly the same output as the one shown in these 3 sample runs. Of course, the position of our worms will be different but everything else should be the same. What we see in each of these 3 sample runs is 1 execution of the code we are to create for this Part 1 of our Project. Note about Sample Run 1: In this Sample Run, the player enters the numbers 1 to 8 sequentially. Wrap around: Worm 2 wraps around: it starts at (row 7, column B), (row 7, column A) then wraps around to (row 7, column J). Worm 6 also wraps around: it starts at (row 2, column E), (row 1, column E) then wraps around to (row 10, column E). Overlap: There are some overlapping worms: worms 5 and 6 overlap at (row 1, column E). Note about Sample Run 2: In this Sample Run, the player enters the numbers 1 to 8 sequentially. Wrap around: Worm 3 wraps around: it starts at (row 1, column B) then wraps around to (row 10, column B) and (row 9, column B). Worm 6 also wraps around: it starts at (row 1, column D) then wraps around to (row 10, column D) and (row 9, column D). Overlap: There are some overlapping worms: worms 2 and 4 overlap at (row 3, column H), worms 1 and 2 overlap at (row 3, column G) and worms 2 and 5 overlap at (row 3, column E). Note about Sample Run 3: In this Sample Run, the player enters the numbers in the following sequence: 3, 2, 6, 4, 5, 1, 7, 8. Wrap around: Worm 3 wraps around: it starts at (row 2, column C), (row 1, column C) then wraps around to (row 10, column C). Worm 1 also wraps around: it starts at (row 2, column B), (row 2, column A) then wraps around to (row 2, column J). Overlap: There are some overlapping worms: worms 6 and 3 overlap at (row 1, column C) and (row 2, column C). Other Requirements: Here are a few more requirements the code we are to create for this Part 1 of our Project must satisfy. 1. The location of each worm in the garden must be determined randomly. 2. Whether a worm is lying horizontally or vertically must also be determined randomly. 3. It is acceptable in Part 1 of our Project if worms overlap each other (see Sample Runs) 4. When placing a worm in a garden, the worm must “wrap around” the garden. See Sample Runs for examples of what “wrapping around” signifies. How will we implement this wrapping around? Hint: wrapping around can be achieved using an arithmetic operator we have already seen. 5. We must make use of docstring when we implement our functions (have a look at our textbook for an explanation and an example). 6. Every time we encounter the word must in this description of Part 1 of our Project, we shall look upon that sentence as another requirement. For example, the sentence “The code we create for this Part 1 of our Project must produce exactly the same output as the one shown in these 3 sample runs.”, even though it is not listed below the Other Requirements heading, is also a requirement because of its must.

Project Part 1 Objective Our objective, in this Part 1 of our Project, is to practise solving a problem by composing and testing a Python program using all that we have learnt so far and discovering new things, such as lists of lists, on the way. Project – Hunting worms in our garden! No more turtles! In this project, we shall move on to worms. Indeed, our project is a game in which the player hunts for worms in our garden. Once our garden has been displayed, the player tries to guess where the worms are located by entering the coordinates of a cell in our garden. When the player has located all the worms, the game is over! Of course there are ways of making this game more exciting (hence complicated), but considering that we have 2 weeks for Part 1 and 2 weeks for Part 2, keeping it simple will be our goal. We will implement our game in two parts. In Part 1, we write code that constructs and tests our data structures i.e., our variables. In Part 2, we write code that allows the player to play a complete “worm hunting” game! ? Project – Part 1 – Description Data Structures (variables): As stated above, in Part 1, we write code that constructs our data structures i.e., our variables. In our game program, we will need data structures (variables) to represent: 1. Our garden that is displayed to the player (suggestion: list of lists), 2. The garden that contains all the worms (suggestion: another list of lists), Garden: Our garden in Part 1 of our Project will have a width and a height of 10. Warning: The width and the height of our garden may change in Part 2 of our Project. So, it may be a good idea to create 2 variables and assign the width and the height of our garden to these 2 variables. 3. Our worms and their information. For each worm, we may want to keep the following information: a. worm number, b. the location of the worm, for example, either the coordinates of the cells containing the worm OR the coordinate of the first cell containing the worm, its length and whether the worm is laying horizontally or vertically. Worms: We will create 6 worms of length 3. 4. And other variables as needed. Testing our data structures: ? Suggestion: as we create a data structure (the “displayed” garden, the garden containing the worms, each worm, etc…), print it with a “debug print statement”. Once we are certain the data structure is well constructed, comment out the “debug print statement”. Code: In Part 1, the code we write must include functions and it must include the main section of our program. In other words, in Part 1, the code we write must be a complete program. In terms of functions, here is a list of suggestions. We may have functions that … ? creates a garden (i.e., a garden data structure), ? creates the worms (i.e., the worm data structure), ? places a worm in the garden that is to hold the worms (i.e., another garden data structure), ? displays the garden on the screen for the player to see, ? displays a worm in the displayed garden, ? etc… ? Finally, in Part 1, the code we write must implement the following algorithm: Algorithm: Here is the algorithm for the main section of our game program: ? Welcome the player ? Create an empty “displayed” garden, (“displayed” because this is the garden we display to the player) ? Create the worms (worms’ information) ? Create an empty “hidden” garden Note 1: “hidden” because one can keep track of the worms in this “hidden” garden, which we do not show to the player. This is why it is called “hidden”. Note 2: One can keep track of worm’s locations using a different mechanism or data structure. It does not have to be a list of lists representing a “hidden” garden. We are free to choose how we want to keep track of where our worms are located in our garden. ? Place each worm in the “hidden” garden (or whatever mechanism or data structure we decide to use) ? Display the “displayed” garden on the screen for the player to see ? While the player wants to play, ask the player for a worm number (1 to 6), read this worm number and display this worm on the “displayed” garden. This is not the game. Remember, we shall implement the game itself in Part 2. Here, in this step, we make sure our code works properly, i.e., it can retrieve worm information and display worms properly. Displaying worms properly: Note that when we create worms and display them, it may be the case that worms overlap with other worms and that worms wrap around the garden. These 2 situations are illustrated in the 3 Sample Runs discussed below. At this point, we are ready for Part 2 of our Project. Sample Runs: In order to illustrate the explanations given above of what we are to do in this Part 1 of our Project, 3 sample runs have been posted below the description of this Part 1 of our Project on our course web site. Have a look at these 3 sample runs. The code we create for this Part 1 of our Project must produce exactly the same output as the one shown in these 3 sample runs. Of course, the position of our worms will be different but everything else should be the same. What we see in each of these 3 sample runs is 1 execution of the code we are to create for this Part 1 of our Project. Note about Sample Run 1: In this Sample Run, the player enters the numbers 1 to 8 sequentially. Wrap around: Worm 2 wraps around: it starts at (row 7, column B), (row 7, column A) then wraps around to (row 7, column J). Worm 6 also wraps around: it starts at (row 2, column E), (row 1, column E) then wraps around to (row 10, column E). Overlap: There are some overlapping worms: worms 5 and 6 overlap at (row 1, column E). Note about Sample Run 2: In this Sample Run, the player enters the numbers 1 to 8 sequentially. Wrap around: Worm 3 wraps around: it starts at (row 1, column B) then wraps around to (row 10, column B) and (row 9, column B). Worm 6 also wraps around: it starts at (row 1, column D) then wraps around to (row 10, column D) and (row 9, column D). Overlap: There are some overlapping worms: worms 2 and 4 overlap at (row 3, column H), worms 1 and 2 overlap at (row 3, column G) and worms 2 and 5 overlap at (row 3, column E). Note about Sample Run 3: In this Sample Run, the player enters the numbers in the following sequence: 3, 2, 6, 4, 5, 1, 7, 8. Wrap around: Worm 3 wraps around: it starts at (row 2, column C), (row 1, column C) then wraps around to (row 10, column C). Worm 1 also wraps around: it starts at (row 2, column B), (row 2, column A) then wraps around to (row 2, column J). Overlap: There are some overlapping worms: worms 6 and 3 overlap at (row 1, column C) and (row 2, column C). Other Requirements: Here are a few more requirements the code we are to create for this Part 1 of our Project must satisfy. 1. The location of each worm in the garden must be determined randomly. 2. Whether a worm is lying horizontally or vertically must also be determined randomly. 3. It is acceptable in Part 1 of our Project if worms overlap each other (see Sample Runs) 4. When placing a worm in a garden, the worm must “wrap around” the garden. See Sample Runs for examples of what “wrapping around” signifies. How will we implement this wrapping around? Hint: wrapping around can be achieved using an arithmetic operator we have already seen. 5. We must make use of docstring when we implement our functions (have a look at our textbook for an explanation and an example). 6. Every time we encounter the word must in this description of Part 1 of our Project, we shall look upon that sentence as another requirement. For example, the sentence “The code we create for this Part 1 of our Project must produce exactly the same output as the one shown in these 3 sample runs.”, even though it is not listed below the Other Requirements heading, is also a requirement because of its must.

info@checkyourstudy.com
at one moment in the football game, player A exert a force to the waist on player B. at the same time ,a teammate of A exerts the same sized force to the south on player B. in what direction is B likely to go because of these forces?

at one moment in the football game, player A exert a force to the waist on player B. at the same time ,a teammate of A exerts the same sized force to the south on player B. in what direction is B likely to go because of these forces?

info@checkyourstudy.com
Use the link provided to answer the questions below. http://www.worlddialogue.org/content.php?id=384 According to the article, what was President George W. Bush’s main rationale for going to war with Iraq? A. Bush believed that by promoting democracy, we promote peace around the world. B. Bush believed that Iraq was a key player in the global drug trade. C. Bush feared Osama bin Laden would assume power in Iraq. D. Intelligence reports showed Iraq was planning to attack Afghanistan. E. Bush had no opinion about invading Iraq. What is the democratic peace theory? A. the theory that indicates that democracy will inevitably spread and we should assist it peacefully B. the theory that economic growth leads to a peaceful democratic state C. the theory that democracies tend not to fight one another D. the theory that the key to a successful democratic transition is through a peaceful transfer of power E. the theory that peace and democracy are actually inconsistent with one another What did Mansfield and Syder conclude happens during the initial phases of democratization? A. Newly democratized countries are incapable of holding independent elections. B. Citizens are more engaged in politics and willing to be peaceful. C. New democracies are the strongest democracies in the world. D. Other countries are more likely to form alliances with new democracies. E. Newly democratized countries become more aggressive and warlike, not less. New democracies are more likely to elect which of the following types of parties into office? A. socialists B. religious extremists C. the country’s elite and wealthy class D. people who personify “the average Joe” E. the largest, most prominent parties According to Mansfield and Snyder’s prescription, what should the United States do with democratizing states? A. provide an international military force to ensure peace B. keep a close eye and replace bad leaders if necessary C. make certain that reforms are implemented in the right order D. strengthen international awareness of democratizing states so that peaceful states can arm themselves E. attempt to push through elections as soon as possible above all else Watch the video below, and then answer the questions below. To save your answers, click the Save to Notebook button above. http://www.youtube.com/watch?v=796LfXwzIUk According to Joseph Nye, what is power transition? A. a change of power among states B. a change of power among presidents C. a change of power within the European Union or other leading organizations D. a change of power within cultures E. a change of power to non-state actors How does Nye define power diffusion? A. a change of power among states B. a change of power in regions C. a change of power within cultures D. a change of power from states to non-state actors E. a change of power from non-state actors to states Which of the following is an example of a non-state actor given by Nye? A. Iranian president Mahmoud Ahmadinejad B. Oxfam C. the former USSR D. socialism E. the mayor of Tehran Why does Nye claim it is important to be cautious of power projections? A. Simple projections don’t tell us much about power transition. B. History is not linear. C. Simple projections tend to focus soley on GDP. D. Simple projections don’t tell you anything about military or soft power. E. all of these options Nye describes a three-dimensional chess game as a metaphor for modern-day power distribution. What is the top board? A. economic power among states B. military power among states C. power among state leaders D. the deciding board for the other two boards E. the board where Kasparov faces off against the computer What is the middle board in Nye’s chess game metaphor? A. non-state actors B. a metaphor for the international underground economy C. military power among states D. economic power among states E. political power among states What is the bottom board in Nye’s chess game metaphor? A. transnational relations B. things that cross borders outside government control C. a place where power is chaotically distributed D. an area where things cross borders outside the control of governments E. all of these options What is the difference between a positive-sum game and a zero-sum game? A. A positive-sum game is when one person has all the power and a zero-sum game is when power is evenly distributed. B. A positive-sum game is a two-player power game and a zero-sum game is a one-player power game. C. A positive-sum game where my gain is your gain and a zero-sum game is my win and your loss. D. A postive-sum game is when you bet and win and a zero-sum game is when you bet and lose. E. A positive-sum game is like Tetris and a zero-sum game is like Super Mario Brothers. Nye quotes Hillary Clinton, describing her foreign policy agenda as utilizing “smart power.” What does this mean? A. Smart power addresses the two great power shifts in the 21st century. B. Smart power is “using all the tools in our toolbox.” C. Smart power combines both hard and soft power. D. Smart power reflects a new narrative of dealing with power. E. all of these options

Use the link provided to answer the questions below. http://www.worlddialogue.org/content.php?id=384 According to the article, what was President George W. Bush’s main rationale for going to war with Iraq? A. Bush believed that by promoting democracy, we promote peace around the world. B. Bush believed that Iraq was a key player in the global drug trade. C. Bush feared Osama bin Laden would assume power in Iraq. D. Intelligence reports showed Iraq was planning to attack Afghanistan. E. Bush had no opinion about invading Iraq. What is the democratic peace theory? A. the theory that indicates that democracy will inevitably spread and we should assist it peacefully B. the theory that economic growth leads to a peaceful democratic state C. the theory that democracies tend not to fight one another D. the theory that the key to a successful democratic transition is through a peaceful transfer of power E. the theory that peace and democracy are actually inconsistent with one another What did Mansfield and Syder conclude happens during the initial phases of democratization? A. Newly democratized countries are incapable of holding independent elections. B. Citizens are more engaged in politics and willing to be peaceful. C. New democracies are the strongest democracies in the world. D. Other countries are more likely to form alliances with new democracies. E. Newly democratized countries become more aggressive and warlike, not less. New democracies are more likely to elect which of the following types of parties into office? A. socialists B. religious extremists C. the country’s elite and wealthy class D. people who personify “the average Joe” E. the largest, most prominent parties According to Mansfield and Snyder’s prescription, what should the United States do with democratizing states? A. provide an international military force to ensure peace B. keep a close eye and replace bad leaders if necessary C. make certain that reforms are implemented in the right order D. strengthen international awareness of democratizing states so that peaceful states can arm themselves E. attempt to push through elections as soon as possible above all else Watch the video below, and then answer the questions below. To save your answers, click the Save to Notebook button above. http://www.youtube.com/watch?v=796LfXwzIUk According to Joseph Nye, what is power transition? A. a change of power among states B. a change of power among presidents C. a change of power within the European Union or other leading organizations D. a change of power within cultures E. a change of power to non-state actors How does Nye define power diffusion? A. a change of power among states B. a change of power in regions C. a change of power within cultures D. a change of power from states to non-state actors E. a change of power from non-state actors to states Which of the following is an example of a non-state actor given by Nye? A. Iranian president Mahmoud Ahmadinejad B. Oxfam C. the former USSR D. socialism E. the mayor of Tehran Why does Nye claim it is important to be cautious of power projections? A. Simple projections don’t tell us much about power transition. B. History is not linear. C. Simple projections tend to focus soley on GDP. D. Simple projections don’t tell you anything about military or soft power. E. all of these options Nye describes a three-dimensional chess game as a metaphor for modern-day power distribution. What is the top board? A. economic power among states B. military power among states C. power among state leaders D. the deciding board for the other two boards E. the board where Kasparov faces off against the computer What is the middle board in Nye’s chess game metaphor? A. non-state actors B. a metaphor for the international underground economy C. military power among states D. economic power among states E. political power among states What is the bottom board in Nye’s chess game metaphor? A. transnational relations B. things that cross borders outside government control C. a place where power is chaotically distributed D. an area where things cross borders outside the control of governments E. all of these options What is the difference between a positive-sum game and a zero-sum game? A. A positive-sum game is when one person has all the power and a zero-sum game is when power is evenly distributed. B. A positive-sum game is a two-player power game and a zero-sum game is a one-player power game. C. A positive-sum game where my gain is your gain and a zero-sum game is my win and your loss. D. A postive-sum game is when you bet and win and a zero-sum game is when you bet and lose. E. A positive-sum game is like Tetris and a zero-sum game is like Super Mario Brothers. Nye quotes Hillary Clinton, describing her foreign policy agenda as utilizing “smart power.” What does this mean? A. Smart power addresses the two great power shifts in the 21st century. B. Smart power is “using all the tools in our toolbox.” C. Smart power combines both hard and soft power. D. Smart power reflects a new narrative of dealing with power. E. all of these options

Use the link provided to answer the questions below. http://www.worlddialogue.org/content.php?id=384 … Read More...
Use the links provided to answer the questions below. http://www.youtube.com/watch?v=9tt6BQDVKu0 http://assets.soomopublishing.com/courses/AG/Fragile_Superpower.pdf NIE Report Why does the report suggest that China and India may or may not become dominant powers in the near future? A. Both countries have high economic and social hurdles to overcome. B. Both countries are only somewhat democratic. C. Both countries lack the military strength and nuclear weaponry to challenge even smaller states. D. Neither country is a member of the UN Security Council. E. Neither country is concerned about global warming and is therefore unfit to become a great power player. According to the U.S. intelligence report discussed in the video, why will the use of nuclear weapons grow more likely? A. Irresponsible powerful countries will want to strike the United States to take over its dominant role in the world. B. There will be a tendency to forget just how dangerous they are as we over-emphasize the importance of international trade. C. Rogue states and terrorist groups may be able to gain greater access to these weapons. D. Since the United States and the Soviet Union are rapidly increasing their weapons building programs, the chances of a nuclear incident becomes higher. E. China is likely to produce nuclear weapons to use against the United States and the Soviet Union. According to the video, is the United States likely to lose its position in the world soon? A. Yes, given the rapid rise of China, we will be seeing a challenge from China in the next 5-10 years. B. Yes, China, in conjunction with India, will rise up against the United States. C. Yes, the Russians are working to undermine the U.S. position actively. D. No, although there appears to be decline, the replacement of the United States as the world leader is not likely to come in the next 10 years. E. No, the United States will actually lose its position after its departure from Iraq in 2012. The Rise of a Fierce Yet Fragile Superpower Why does Susan Shirk say that China is fragile? A. China is fragile because it isn’t a democratic country and will have a difficult time managing relations with other states because of this. B. China is fragile because it has a shrinking economy, so despite its size, China is actually very weak. C. China is fragile because its leaders tend to exacerbate the tensions between states like the Soviet Union and the United States. D. China is fragile because it cannot develop a strong sense of human rights and so its people may try to revolt against it. E. China is fragile because its rate of expansion has created gaps between the wealthy and poor and it has a problem of control with decentralized local governing structures. According to scholars, is a war between the rising power and the current power leader inevitable? A. No, while some scholars believe this is true, others suggest that a “peaceful rise” is possible. B. No, history indicates that all great power transitions have been peaceful. C. Yes, scholars indicate that all of our historical examples of great power transition have been through war. D. Yes, although there are examples of peaceful rise, there is too much cultural difference for that to occur with China. E. Yes, since tension between the United States and China is so strong, scholars agree that a war is coming.

Use the links provided to answer the questions below. http://www.youtube.com/watch?v=9tt6BQDVKu0 http://assets.soomopublishing.com/courses/AG/Fragile_Superpower.pdf NIE Report Why does the report suggest that China and India may or may not become dominant powers in the near future? A. Both countries have high economic and social hurdles to overcome. B. Both countries are only somewhat democratic. C. Both countries lack the military strength and nuclear weaponry to challenge even smaller states. D. Neither country is a member of the UN Security Council. E. Neither country is concerned about global warming and is therefore unfit to become a great power player. According to the U.S. intelligence report discussed in the video, why will the use of nuclear weapons grow more likely? A. Irresponsible powerful countries will want to strike the United States to take over its dominant role in the world. B. There will be a tendency to forget just how dangerous they are as we over-emphasize the importance of international trade. C. Rogue states and terrorist groups may be able to gain greater access to these weapons. D. Since the United States and the Soviet Union are rapidly increasing their weapons building programs, the chances of a nuclear incident becomes higher. E. China is likely to produce nuclear weapons to use against the United States and the Soviet Union. According to the video, is the United States likely to lose its position in the world soon? A. Yes, given the rapid rise of China, we will be seeing a challenge from China in the next 5-10 years. B. Yes, China, in conjunction with India, will rise up against the United States. C. Yes, the Russians are working to undermine the U.S. position actively. D. No, although there appears to be decline, the replacement of the United States as the world leader is not likely to come in the next 10 years. E. No, the United States will actually lose its position after its departure from Iraq in 2012. The Rise of a Fierce Yet Fragile Superpower Why does Susan Shirk say that China is fragile? A. China is fragile because it isn’t a democratic country and will have a difficult time managing relations with other states because of this. B. China is fragile because it has a shrinking economy, so despite its size, China is actually very weak. C. China is fragile because its leaders tend to exacerbate the tensions between states like the Soviet Union and the United States. D. China is fragile because it cannot develop a strong sense of human rights and so its people may try to revolt against it. E. China is fragile because its rate of expansion has created gaps between the wealthy and poor and it has a problem of control with decentralized local governing structures. According to scholars, is a war between the rising power and the current power leader inevitable? A. No, while some scholars believe this is true, others suggest that a “peaceful rise” is possible. B. No, history indicates that all great power transitions have been peaceful. C. Yes, scholars indicate that all of our historical examples of great power transition have been through war. D. Yes, although there are examples of peaceful rise, there is too much cultural difference for that to occur with China. E. Yes, since tension between the United States and China is so strong, scholars agree that a war is coming.

Use the links provided to answer the questions below. http://www.youtube.com/watch?v=9tt6BQDVKu0 … Read More...