Create the logic for a game that simulates rolling two dice by generating two random numbers between 1 and 6 inclusive. The player chooses a number between 2 and 12 (the lowest and highest totals possible for two dice). The player then “rolls” two dice up to three times. If the number chosen by the user comes up, the user wins and the game ends. If the number does not come up within three rolls, the computer wins. (5.1, 5.2) Must use the following declarations in your flowchart or pseudocode. Declarations num dice1 num dice2 num guess num count num won num LIMIT = 6 string PROMPT = "Choose a number between 2 and 12 >> " string WIN = "You win!" string LOSE = "You lose
Q: Repeat all activity from 2.3.4. Provide similar array manipulations using the months of the year.…
A: The JavaScript code snippet shows month-based array manipulation. The "months" array is initialized…
Q: Describe the advantages of unit testing while using C#
A: Unit testing is a foundational aspect of software development, focusing on testing specific units or…
Q: Don't give me AI generated answer
A: Define a Product class with attributes: name, features, price, and nutritional_info.Define a…
Q: using assembly intel syntax 64 language write a code that adds two 16-bit hex numbers and stores…
A: Definitely! Below are assembly language (x86_64) code snippets for adding and subtracting two 16-bit…
Q: Xyxyyyy
A: The objective of this question is to understand the challenges that are associated with storing and…
Q: A Java if else statement has the general form: if (?) { statement or statements } else {…
A: High-level, object-oriented Java programming was created by Sun Microsystems, which was later…
Q: Conditional Logic Which of the following Excel functions can replace nested IF() statements? (Select…
A: The objective of the question is to identify the Excel functions that can be used as alternatives to…
Q: Write a Java program named Words that asks the user to enter four words. The program should then…
A: The objective of the question is to create a Java program that takes four words as input from the…
Q: Let Σ = {a, b}. For each k ≥ 1, let Ck be the language consisting of all strings that contain an a…
A: NFA stands for Non-deterministic Finite Automata. It contains many paths for particular input symbol…
Q: 1.20 For each of the following languages, give two strings that are members and two strings that are…
A: The phrases "member" and "not member" in the context of formal language theory denote whether or not…
Q: I know you guys are using AI. Don't you dare give me AI generated answer or plagiarised answer. If I…
A: Total Books:Sum the "quantity" value in each book dictionary.Print the total sum.Highest…
Q: Ccvvbb
A: The objective of this question is to understand the challenges that are faced when storing and…
Q: Write a function called makemat that will receive two row vectors as input arguments, and from them…
A: MATLAB which refers to the programming platform which are designed specifically for engineers and…
Q: 2. There are several design goals in building an operating system, for example, resource…
A: An operating system (OS) is a type of software that acts as a bridge between a computer system's…
Q: Write a pseudocode and create a flowchart for this question; The colors red, blue, and yellow…
A: The main colors—red, blue, and yellow—rule the complex universe of hues. Because they cannot be…
Q: Read in the tree inventory file, created in Lab 3W, and show a count of the number of times a…
A: Read in the tree inventory file, created in Lab 3W, and show a count of the number of times a…
Q: Computer Forensics & Investigation: Why is it possible to recover deleted files from a computer or…
A: Computer forensics and investigation involve the examination of digital devices to uncover evidence…
Q: Keegan and Hossein founded Apadana Holdings, which operates under the name Mica Paint and Hardware.…
A: Digital technology encompasses a wide array of tools and systems that harness electronic or…
Q: 3. Let - (10-¹6 1) A = b-(3) and b = Here we will see the effect of using a tiny element as a pivot.…
A: The system to be solved is:A⋅x=bwhere matrix A and vector b are given by:Solving the linear system…
Q: Write a program that asks the user for an integer Celsius temperature. Convert Celsius temperatures…
A: The objective of this C++ program is the conversion of Celsius temperatures to Fahrenheit…
Q: III) Convert the NFA to a DFA a, b
A: NFA: State Transition Table: ab0{0,1}{0,2}1{3}{ }2{ }{3}*3{3}{3}
Q: How has the employment of artificial intelligence (AI) techniques in computer chess significantly…
A: The objective of the question is to understand the impact of artificial intelligence (AI) techniques…
Q: Describe the use of the .NET ICloneable, IComparable<>, and IEnumerable<> interfaces. In…
A: The question is asking about the use of three different interfaces in .NET, specifically in the…
Q: Explain the challenges of storing and managing big data
A: The objective of this question is to understand the challenges that are associated with storing and…
Q: Consider the following program: int x=2,y =3 co x=x-1; x=x+1; || y=y+1;y=y-1; oc What are the…
A: The given program involves concurrent execution of statements, denoted by the `co` and `oc` blocks,…
Q: Question: How do you change the datapath below to enable unconditional jumps (j)? Draw the necessary…
A: The objective of the question is to modify a given datapath to enable unconditional jumps (j) and…
Q: Explain why you would not conclude that the quality of program X was twice as great as program Y if…
A: In the domain of software development, integration testing plays a pivotal role in evaluating the…
Q: Please answer the following Operating Systems Questions: 1. On early computers, every byte of data…
A: In this question we have to answer questions related to operating systems:Question 1: Implications…
Q: In this task, the list items are the navigation for a site. They should be laid out as a row, with…
A: I have provided HTML CODE along with OUTPUT SCREENSHOT...
Q: Q5. Map the following ER diagram into a relational schema and specify all primary keys and foreign…
A: An Entity-Relationship (ER) diagram is a visual representation of entities, their attributes, and…
Q: Give examples of relations that are: (a) reflexive and symmetric but not transitive (b) reflexive…
A: (a) Reflexive and symmetric but not transitive: Let's consider a set A = {1, 2, 3}, and define a…
Q: In Java, if we say int[] myArray = new int[10];, then myArray has 10 entries with indices…
A: The question is asking whether in Java, when we declare an array with a size of 10, the indices of…
Q: Create a class named Percentages whose main() method holds two double variables, and prompt the user…
A: Please refer to the following for the algorithm of the code above =>Start: Begin the…
Q: Consider the following program: int x = 0, y = 10; co while(x!= y) x=x+1; || while ( x != y ) y = y…
A: We initialize two variables x and y with 0 and 10, respectively.Then, we have two concurrent…
Q: In the realm of enchanted kingdoms, the Mystic Gatekeepers employ an intricate system of magical…
A: Define a function to check if a number is prime.Define a function to validate a mystical code.Create…
Q: 1.18 Give regular expressions generating the languages of Exercise 1.6. here is 1.6 Give state…
A: In the context of formal language theory, deterministic finite automata (DFA) and regular…
Q: Write two overloaded methods in a class named AverageOfArray that return the average of an array…
A: 1) Below is JAVA program that write two overloaded methods in a class named AverageOfArray that…
Q: CHALLENGE ACTIVITY 2.11.1: Enter the output of the integer expressions. 547700.3242818.qx3zqy7 Jump…
A: Step-1: StartStep-2: Declare variable x and y Step-3: In x assign 1Step-4: In y assign 2 *…
Q: 1 READ A 2 READ B 3 Sum = A + B Provide the Test cases for 100% Statement coverage. For this convert…
A: Every code statement must be performed during testing to obtain 100% statement coverage. Given…
Q: Eddddss
A: The objective of the question is to understand the challenges that are faced while storing and…
Q: I'm currently grappling with a specific challenge and was hoping to seek your assistance. I've…
A: We need to give regular expressions for the DFA to recognize the language {w| w starts with 0 and…
Q: Which of the following statements are true. An array is one name for several memory…
A: The objective of the question is to verify the truthfulness of the given statements about arrays in…
Q: I having problems with MATLAB ode45 solver. For the following code, Matlab is giving me index…
A: Corrected the syntax for tspan to [0 20].Corrected the initial conditions syntax for ode45 to [w;…
Q: Solve this proof with no premises: (~Q->~P)->((~Q->P)->Q)
A: The objective of the question is to solve a logical proof with no premises. The proof is:…
Q: All member variables should - in most cases - be declared with this access specifier.…
A: The question is asking about the most appropriate access specifier for member variables in most…
Q: a) Using your stoichiometric matrix demonstrate that mass is conserved per reaction and also total…
A: The question is asking to demonstrate mass and moles conservation per reaction, as well as total…
Q: From the adjacency matrix, use Warshall's algorithm to find the connectivity relation matrix.
A: For every vertex pair (i, j) in a directed graph, ascertain if a vertex j can be reached from…
Q: What are the key components and functions of an ALU (Arithmetic Logical Unit) in a computing system?
A: An ALU (Arithmetic Logic Unit) which is a part of the CPU, is the principle element of a computer's…
Q: All member variables should - in most cases - be declared with this access specifier.…
A: The question is asking about the most appropriate access specifier for member variables in most…
Q: b) What is this single precision floating point number using IEEE 754 encoding in decimal notation?…
A: In computer science and numerical representation, a floating-point number format specified by the…
Create the logic for a game that simulates rolling two dice by generating two random numbers
between 1 and 6 inclusive. The player chooses a number between 2 and 12 (the lowest and highest totals possible
for two dice). The player then “rolls” two dice up to three times. If the number chosen by the user comes up, the
user wins and the game ends. If the number does not come up within three rolls, the computer wins. (5.1, 5.2)
Must use the following declarations in your flowchart or pseudocode.
Declarations
num dice1
num dice2
num guess
num count
num won
num LIMIT = 6
string PROMPT = "Choose a number between 2 and 12 >> "
string WIN = "You win!"
string LOSE = "You lose!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
- JavaScript Programming One day, Fred and his N friends were playing a card game in which each player throws a card with a number written on it. The cards are such that a number X is written on front of the card, and the negative of that number is written on the back side of the card. This game has the following rules: - Each of the N players is asked to throw a card. After all the N cards are thrown, Fred has to flip one or more cards in consecutive order, only orice. Your task is to help Fred flip the cards in such a way that the sum of the numbers, on front face of the cards, is the maximum. Your Task is to return the maximum sum of the numbers, on the front cards. Input Output 13 -1 2 3 4 -51. In the game of Monopoly, a pair of dice are rolled to move a player's piece around the board. If a double is rolled (the dice show the same number), the player receives another roll of the dice. If a double is rolled a second time, a third roll of the dice is received. If a double is rolled on the third occasion, the player forfeits their turn (and goes to Jail). Write a program which simulates two players having 50 turns each (a turn however many dice rolls a player has in a row before it's the other player's turn) and determines: a) the total number of spaces moved by each player; and b) how many times a player rolls a double which results in movement of a piece. Use the randi function. For fun, incorporate the rule that a player cannot leave Jail (cannot move) unless they either roll a double or three turns have passed without rolling a double.Java program At a certain university, students have to submit their exams online. The administration decides that for each minute of late submission, 5 points are deducted. Write a program that asks the user for his initial grade and the late submission time (in minutes), and then displays the final result. Sample Run 1: Enter your initial grade: 82 Enter the late submission time (in minutes): 6 Your final grade is 52 Sample Run 2: Enter your initial grade: 115 Grades should be between 0 and 100 Sample Run 3: Enter your initial grade: 43 Enter the late submission time (in minutes): 10 Your final grade is 0 Sample Run 4: Enter your initial grade: 72 Enter the late submission time (in minutes): -2 Time should be positive
- The Game of Master Mind is performed in the following way:Each of the computer's four slots will hold a ball that is either red (R), yellow (Y), green (G), or blue (B). The computer may have the following configuration: RGGB (Slot #1 is red, Slots #2 and #3 are green, and Slot #4 is blue).The user is making an educated guess at the answer. For instance, you may assume YRGB.You receive a bonus when you predict the right colour for the right slot "hit:' You receive an if you choose a colour that is real but is in the incorrect slot "pseudo-hit:' Keep in mind that a hit slot can never also qualify as a pseudo-hit.For example, if the actual solution is RGBY and you guess GGRR, you have one hit and one pseudohitWrite a method that, given a guess and a solution, returns the number of hits and pseudo-hitsDesign and implement an application that plays the Rock-PaperScissors game against the computer. When played between two people, each person picks one of three options (usually shown by a hand gesture) at the same time, and a winner is determined. In the game, Rock beats Scissors, Scissors beats Paper, and Paper beats Rock. The program should randomly choose one of the three options (without revealing it) and then prompt for the user’sselection. At that point, the program reveals both choices and prints a statement indicating whether the user won, the computer won, or it was a tie. Continue playing until the user chooses to stop. Then print the number of user wins, losses, and ties.Pig is a game that has two players that alternate turns rolling dice. In this case, there will be one human player and one computer player. Each player’s goal is to get 100 points rolled on a normal six-sided die first. Each turn consists of rolling the die repeatedly until you decide to stop or until you roll a 1. For each roll: • If you roll a 2, 3, 4, 5, or 6 –you will add the amount rolled to your score.• If you roll a 1 – your turn ends and you receive zero points for that entire turn (You will keep whatever points you had before your turn started)• If you decide to stop rolling at any point in your turn, your points for that turn are then added to the overall score. The overall score is then safe from future rolls.Use functions to break apart the code into logical portions
- Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows:1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don’tdisplay the computer’s choice yet.)2. The user enters his or her choice of “rock,” “paper,” or “scissors” at the keyboard.3. The computer’s choice is displayed.4. A winner is selected according to the following rules:• If one player chooses rock and the other player chooses scissors, then rock wins. (Therock smashes the scissors.)• If one player chooses scissors and the other player chooses paper, then scissors wins.(Scissors cuts paper.)• If one player chooses paper and the other player chooses rock, then paper wins. (Paperwraps rock.)• If both players make the same choice, the game must be…The Game of Nim: The game of Nim starts with a random number of stones between 15 and 30. Two players alternate turns and on each turn may take either 1, 2, or 3 stones from the pile. The player forced to take the last stone loses. The computer player will make random choices during their turn. Your program must check to make sure that neither the computer nor the human player attempts to take 3 if there are only 1 or 2 stones left. The computer should only take 1 or 2 stones when 3 are left, and only 1 stone when 2 stones are left. Make sure you are using functions, importing random, and making it at around grade 10 coding levels, haha!Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 5.1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. Don’t display the computer’s choice yet. 5.2. The user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard. Gather this input using JOptionPane.showInputDialog(). 5.3. Display the computer’s choice. 5.4. A winner is selected according to the following rules: If one player chooses rock and the other player chooses scissors, then rock wins. Display something to the effect of: “Rock smashes the scissors.” If one player chooses scissors and the other player chooses paper, then scissors wins. Display something like: “Scissors cuts paper.” If one player chooses paper and the other…
- Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 5.1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. Don’t display the computer’s choice yet. 5.2. The user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard. Gather this input using JOptionPane.showInputDialog(). 5.3. Display the computer’s choice. 5.4. A winner is selected according to the following rules: If one player chooses rock and the other player chooses scissors, then rock wins.Display something to the effect of: “Rock smashes the scissors.” If one player chooses scissors and the other player chooses paper, then scissors wins.Display something like: “Scissors cuts paper.” If one player chooses paper and the other player…Write a program that plays a dice game called "21" It is a variation on BlackJack where one player plays against the computer trying to get 21 or as close to 21 without going over. Here are the rules of the game: You will play with dice that have numbers from 1 to 11. To win, the player or the computer has to get to 21, or as close as possible without going over. If the player or computer goes over 21, they instantly lose. If there is a tie, the computer wins. Starting the game: The player is asked to give the computer a name. For now, we'll simply call the computer opponent, "computer." The game starts with rolling four dice. The first two dice are for the player. These two dice are added up and the total outputted to the screen. The other two dice are for the computer. Likewise, their total is outputted to the screen. Player: If a total of 21 has been reached by either the player or the computer, the game instantly stops and the winner is declared. Otherwise,…this code should be in python: First, it is randomly determined if the user starts the game or the computer and this information is shown to the user. The player who starts always starts as “X”. •The players (computer and the user) will then take turns in playing. The computer willchoose a random empty spot on its turn. The user enters its choice in the console.• Each of the empty spots have a corresponding number that the players choose on theirturn. If the user enters anything other than the number of an empty spot (not yet filledwith “X” or “O”), it will not be accepted, and they will be prompted to enter a correctnumber.…