To solve the given problem we are using Rubric .
What is Rubric?
a strong directive. especially: a liturgical service conduct guideline. b(1): title and name. specifically: the statute's name.
Code for the problem:
def printCourses(l):
if len(l)==0:
print("You aren't currently taking any courses.")
else:
print('You are currently taking these courses:')
for i in range(len(l)):
print(str(i+1)+': '+l[i]) #main
l=[] printCourses(l)
while(len(l)!=5):
if len(l)<5:
s=input('What courses would you like to take? ')
s = s.split(',')
for i in s:
l.append(i.strip().capitalize())
else:
s=input('What courses would you like to drop? ')
s = s.split(',')
for i in s:
if i.strip().capitalize() in l:
l.pop(l.index(i.strip().capitalize()))
printCourses(l)
Output:
You aren't currently taking any courses.
What courses would you like to take? math,physics, SCIENCE
You are currently taking these courses:
1: Math
2: Physics
3: Science
What courses would you like to take? Sociology ,english,CompSci, psychology
You are currently taking these courses:
1: Math
2: Physics
3: Science
4: Sociology
5: English
6: Compsci
7: Psychology
What courses would you like to drop? compsci
You are currently taking these courses:
1: Math
2: Physics
3: Science
4: Sociology
5: English
6: Psychology
What courses would you like to drop? Pyhsics, English, science
You are currently taking these courses:
1: Math
2: Physics
3: Sociology
4: Psychology
What courses would you like to take? English, Science
You are currently taking these courses:
1: Math
2: Physics
3: Sociology
4: Psychology
5: English
6: Science
What courses would you like to drop? physics
You are currently taking these courses:
1: Math
2: Sociology
3: Psychology
4: English
5: Science
Learn more about Rubric click here:
https://brainly.com/question/25916190
#SPJ4
Which of the following is challenge of sustaining technology?
a. Provides a cheaper product for current customers.
b. Provides a faster product for current
customers.
c. Provides a product that does not meet existing customer's future needs.
d. Provides a better product for current customers.
The challenge of sustaining technology is providing a product that does not meet existing customers' future needs. The correct option is c.
What is sustaining technology?It involves evolution and betterment, working within established markets and with pre-existing products and ideas, but rating, improving the show, and generally making things better.
The smartphone market is an illustration of enduring innovation because every year, cell phone manufacturers. Sustaining innovation occurs when a company creates better-performing products to sell for higher profits to its best customers.
Therefore, the correct option is c, the challenge of sustaining technology.
To learn more about sustaining technology, refer to the link:
https://brainly.com/question/25719495
#SPJ1
true or false? american institute of certified public accountants (aicpa) service organization control (soc) 2 reports are commonly implemented for service providers, hosted data centers, and managed cloud computing providers.
In 1939, the American Institute of Certified Professional Accountants (AICPA) established a committee to develop accounting standards and reports for the private sector. This committee developed Generally Accepted Accounting Practices (GAAP) for use by accounting professionals. It is a collection of commonly-followed accounting rules and standards for financial reporting.
What is GAAP?
A unified set of accounting guidelines, methods, and standards known as generally accepted accounting principles (GAAP) were released by the Financial Accounting Standards Board (FASB). When their accountants put together a public company's financial statements, they must adhere to GAAP in the United States.
Ten basic principles serve as the framework for GAAP, which is a set of regulations. The International Financial Reporting Standards (IFRS), which are seen as more of a principles-based norm, are frequently used as a comparison. There have recently been initiatives to move GAAP reporting to IFRS because it is a more global standard.
Learn more about GAAP click here:
https://brainly.com/question/28345482
#SPJ4
a file of style rules with a .css file extension holds a(n) cascading style sheet.
A file of style rules with a .css file extension holds a(n) External cascading style sheet.
What does an HTML external CSS mean?A set of CSS rules is all that an external style sheet is. HTML tags are not permitted in it. To link to an external style sheet, use the link> tag, which is placed in the head of an HTML page. There is no restriction on how many external style sheets one HTML page can use.
Therefore, With an external style sheet, you can alter just one file to alter the entire appearance of a website! The link> element in the head section of every HTML page needs to contain a reference to the external style sheet file.
Learn more about css file extension from
https://brainly.com/question/27818468
#SPJ1
you are providing a vpn solution for employees who work remotely. when these employees change locations, they lose their vpn connection, so you want them to automatically reconnect if the vpn connection is lost or disconnected. which vpn security protocol supports vpn reconnect functionality?
you are providing a virtual private network (vpn) solution for employees who work remotely. when these employees change locations, they lose their vpn connection, so you want them to automatically reconnect if the vpn connection is lost or disconnected. Internet Key Exchange version 2 (IKEv2) is required to use the VPN Reconnect functionality.
What is a VPN connection?
Users can send and receive data across shared or public networks using a virtual private network, which extends a private network across the latter and makes it appear as though their computing devices are directly connected to the former.
In order to protect your data and communications while using public networks, a VPN creates a secure, encrypted connection between your computer and the internet.
To learn more about Virtual Private Networks, use the link given
https://brainly.com/question/28110742
#SPJ4
true or false? the purpose of a security audit is to make sure computing environments and security controls work as expected.
True: the purpose of a security audit is to make sure computing environments and security controls work as expected.
What is cybersecurity?Cybersecurity can be defined as a preventive practice that is typically used for protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access, especially through the use of technology, frameworks, security policies, processes and network engineers.
In Cybersecurity, security auditing and analysis is a strategic information security processes that is designed and developed to ensure computing environments and security controls all work as they should, especially by ensuring they are in tandem with the security policies.
In this context, we can reasonably infer and logically deduce that ensuring all of the computing environments and security controls is the main purpose of a security audit and analysis.
Read more on security here: https://brainly.com/question/14286078
#SPJ1
jorge is reading a document that he knows contains comments, but he is unable to see them. in order to view the comments, he can press the show markup button on the tracking group of the review tab and then ensure that the comments option is selected.
The tracking group of the review tab and then ensure that the comments option is true.
What is review tab?The purpose of the Review tab is to provide an opportunity to review the document and get feedback on final changes. The Reviews tab is divided into several groups. Correct, Language, Accessibility, Language, Comment, Follow Up, Change, Compare, Ink, Continue. Click the Validation icon on the top ribbon to display the Validation window. A confirmation panel appears on the left side of the screen. Microsoft Word has features that let you track changes made by multiple users and review features that allow reviewers to add comments to the document. These features are very useful when you are part of a peer group that needs to work together on a project.
Learn more about review tab: https://brainly.com/question/22408362
#SPJ9
why is the list constructor commonly used to find an index of an array element?
The list constructor is commonly used to find an index of array as it returns the array value for a particular index.
An array allows you to store multiple values with the same name and access them by using an index number.
A block of memory known as an array is used to store a group of identically typed data objects (also known as elements). When you need to keep track of numerous identical data elements but don't need to name them all, arrays come in handy. The position of an item in the array is instead indicated by the array name and a number (referred to as an index). You are able to create arrays of ints, doubles, Strings, and even custom classes like Students.
An index can be used to store a value in an array A locker number is similar to an array index. It makes it easier for you to locate a specific location to keep and get items. Using an index, you can retrieve or add a value from or to an array.
Most programming languages count elements in lists and arrays starting at index 0, so the first element in an array is at index 0. An integer that designates a spot in an array is called an array index. The first character is at index 0, which is similar to how Strings are indexed in Java. In Java, arrays start the index at 0 not 1.
For example, if we want to make an array with 5 elements of type int the the following displays the indexes and values it:
index 0 1 2 3 4 5
value 8 55 88 5 -3 67
To learn more about list constructor click here:
brainly.com/question/28025015
#SPJ4
a central issue in the microsoft antitrust lawsuit involved microsoft's integration of its internet browser into its windows operating system, to be sold as one unit. this practice is known as group of answer choices wholesale maintenance. retail maintenance. tying. predation.
A central issue in the Microsoft antitrust lawsuit involved Microsoft's integration of its internet browser into its windows operating system, to be sold as one unit is a practice that is known as: C. tying.
What is an operating system?In Computer technology, an operating system (OS) can be defined as a system software that's usually pre-installed on a computing device by the manufacturers, in order to manage random access memory (RAM), software programs, computer hardware and all user processes.
Microsoft was involved in an antitrust lawsuit with respect to tying the integration of its internet (web) browser into its windows operating system (OS) such as Windows 7, 8, 10, etc., in order to sell them to end users as a single unit.
Read more on operating system here: brainly.com/question/22811693
#SPJ1
Once you’ve selected a sound in Scratch, what is a special effect that can be applied to that sound? A. robot B. alien C. reverb D. dinosaur
Once you’ve selected a sound in Scratch, a special effect that can be applied to that sound is reverb. The correct option is C.
What is the reverb effect?Reverb is absolutely present everywhere. We are always surrounded by the ambient acoustic effect, which happens when sound waves released from a sound source bounce off the surfaces in a place at different rates and intensities, producing a sequence of audible reflections.
Reverb and slow effect is the effects that make the song slow and vibrant, and it makes the voice of the song a little thick.
Therefore, the correct option is C. reverb.
To learn more about the reverb effect, refer to the link:
https://brainly.com/question/29036904
#SPJ1
A local variable can be accessed from anywhere in the program.
a. True
b. False
Answer:False
Explanation: A local variable can accessed throughout the program by all the functions in the program . It can only be accessed by the function statements in which it is declared not other functions.
Play a text-based adventure game (10 points)
The game must ask the user to make 3 choices at least twice.
It must use at least one loop and one randomizing element
The game must have at least 2 different ending depending on the user’s choice
Python
Using the knowledge in computational language in python it is possible to write a code that must use at least one loop and one randomizing element and must have at least 2 different ending depending on the user’s choice.
Writting the code:print("\nMovement commands : North, South, East, or West")
print("Add to inventory: Get item\n")
introduction() # I just cut my long-winded intro. it works.
rooms = {
'House': {'north': 'Drug Store', 'south': 'Clinic', 'east': 'Kitchen', 'west': 'Craft Store'},
'Drug Store': {'south': 'House', 'east': 'Electronics Store', 'item': 'Hand Sanitizer'},
'Electronics Store': {'west': 'Drug Store', 'item': 'ANC Headphones'},
'Craft Store': {'east': 'House', 'item': 'A Mask'},
'Clinic': {'north': 'House', 'east': 'CDC', 'item': 'A Vaccine'},
'CDC': {'west': 'Clinic', 'item': 'Dr Fauci Candle'},
'Kitchen': {'west': 'House', 'north': 'State of Florida', 'item': 'Anti-viral Spray'},
'State of Florida': {'item': 'COVID-19'} # VILLAIN, final room
}
current_room = 'House' # location variable that will change as player moves
inventory = [] # empty list that will fill as you collect items
directions = ('north', 'south', 'east', 'west') # possible movements
item = ('hand sanitizer', 'anc headphones', 'a mask', 'a vaccine', 'dr fauci candle',
'anti-viral spray', 'covid-19')
while True:
print('\nYou are in the {}'.format(current_room)) # current game status
print('Inventory: {}'.format(inventory))
if 'item' not in rooms[current_room]:
pass
else:
print('You see {}'.format(rooms[current_room]['item']))
print('-' * 25)
command = input('Enter your move:\n').lower().strip()
if command in directions:
if command in rooms[current_room]:
current_room = rooms[current_room][command]
if current_room in ['State of Florida']:
if len(inventory) == 6:
print('You have contracted COVID-19! G A M E O V E R')
else:
print('You have defeated COVID-19!')
print('Thank you for protecting your fellow teammates.')
break
See more about python at brainly.com/question/12975450
#SPJ1
which of the following software is a general purpose application software used in business? accounts receivable software microsoft excel microsoft windows c
Accounts Receivable Software is the following software is a general purpose operation software used in business.
What is General purpose software?
Software that has a wide range of operations is appertained to as general purpose software. Office operations like word processing and donation software are exemplifications of general- purpose software.
A company's credit administration, cash operation, invoicing, payments, collections, and other procedures are automated using accounts delinquent software. It offers advanced perfection and a better manner for leadership to handle both customer relations and the cash inflow cycle.
Depending on the size of the business and its objects for managing accounts delinquent, different account software may be stylish. The rates to look for in AR software are listed below.
Cash inflow controlelectronic B to B payments Automatic credit operation processescreation and distribution of invoices automatic operation of money automated emails for collections are:
Cash flow controlelectronic B to B paymentsAutomatic credit application processescreation and distribution of invoicesautomatic application of moneyautomated emails for collectionsLearn more about Accounts Receivable Software click here:
https://brainly.com/question/24848903
#SPJ4
could the total completion time be further improved by allowing people to work on activities outside of their official team designation? justify your response with appropriate reasoning.
No, the total completion time be further improved by allowing people to work on activities outside of their official team designation.
What do you know about official team designation?
Employees are given designations as their official job titles.
A company's directors, officers, managers, and shareholders are just a few of the stakeholders that help it manage itself so that its business goals are achieved.
Critical tasks may require additional staff members because any delay in their completion time results in a longer overall completion time. Assume you can reassign team members to a task using the guidelines below:
No one is allowed to work on a project outside of their team. For instance, a computer programmer can only be assigned to activities 1, 2, 3, or 4 and not to any of the others.Every task must always have at least one person assigned to it.For each additional person assigned to an activity, it may be finished one week earlier.Learn more about designation click here:
https://brainly.com/question/28726975
#SPJ4
The team uses its ________ to determine how many requirements it can commit to accomplishing in the next scrum period.
The team uses its Team velocity to determine how many requirements it can commit to accomplishing in the next scrum period.
What is Team velocity?
Team velocity is described by Scrum, Inc. as "the key statistic in Scrum" and "measures the quantity of work a team can handle during a single sprint." After some time, you'll figure out the average number of points you finish each sprint by adding up the points for all fully finished user stories.
A team completes a predetermined amount of work during a timed period called a Scrum sprint cycle. Each sprint begins as soon as the previous one is over and lasts for two to four weeks on average.
The Scrum sprint cycle is frequently described as a continuous development process. It gives product releases a predictable work cadence and maintains the project's momentum until completion.
The Scrum sprint cycle is represented by five events, according to the official Scrum Guide: sprint planning, daily scrum, sprint review, and sprint retrospective. The sprint itself, which houses the other four, is the fifth item.
Here's some more information about what happens throughout a Scrum sprint cycle.
Sprint planning: Beginning the Sprint and outlining the tasks that must be accomplishedDaily Scrum: Developers meet every day for fifteen minutes to discuss their work, any obstacles, and what they will be working on next. Sprint review: Developers assess what was delivered and choose what should be worked on in the following sprint.Sprint retrospective: An analysis of the procedure to enhance the following sprint.Learn more about scrum period click here:
https://brainly.com/question/28049439
#SPJ4
log files can help provide evidence of normal and abnormal system activity, as well as valuable information on how well security controls are doing their jobs. regulation, policy, or log volume might dictate how much log information to keep. if a log file is subject to litigation, how long must a company keep it?
A company must keep it until it provides valuable information on how well it controls the process of doing its jobs.
What is the significance of log files?The significance of log files is understood by the fact that they include information about system performance that can be utilized in order to determine some additional capacity that is required to optimize the experience of the user.
According to the context of this question, if log files fill up, then a user must definitely be faced some bad choices like stopping logging, overwriting the oldest entries stopping the process controlled, or ultimately crashing.
Therefore, a company must be responding its output on the basis of the functionality of log files.
To learn more about Log files, refer to the link:
https://brainly.com/question/28484362
#SPJ1
(a) how many one-to-one functions are there from a set with four elements to a set with five elements? there are choices for where to send the first element of the domain, choices for where to send the second element of the domain, and so forth. thus, the total number of one-to-one functions is . (b) how many one-to-one functions are there from a set with four elements to a set with three elements? (c) how many one-to-one functions are there from a set with four elements to a set with four elements? (d) how many one-to-one functions are there from a set with four elements to a set with six elements?
The number of one-to-one functions is given as follows:
a) Four to five: 120.
b) Four to three: 24.
c) Four to four: 24.
d) Four to six: 360.
What is a one-to-one function?A one-to-one function is a function in which each element of the output is mapped to at most one element of the input.
The permutation formula is used to give the number of possible functions in this problem, which is given as follows:
[tex]P_{(n,x)} = \frac{n!}{(n-x)!}[/tex]
Giving the number of permutations of x elements from a set of n elements.
Hence the amount for item a is given as follows:
5!/(5 - 4)! = 5! = 120.
For item b, the amount is given as follows:
4!/(4 - 3)! = 4! = 24.
For item c, the amount is given as follows:
4!/(4 - 4)! = 4! = 24.
As the factorial of zero is of 1.
For item d, the amount is given as follows:
6!/(6 - 4)! = 6!/2! = 360.
More can be learned about one-to-one functions at https://brainly.com/question/15271413
#SPJ1
which x11 window system element is the main system component?
Answer: X11 Server.
Explanation:
The component X11 server of X11 window system element is the main system component.
What is a server?A server is a software component or hardware (computer program) used in technology that offers functionality to the other applications or devices that are used in other applications. Known as the client-server model, this architecture.
The activities that servers might offer are frequently referred to as "services," and they can include tasks like completing calculations for a client or distributing resources or data among several clients.
Both a single client and a single server are capable of supporting many clients. It is possible for a client process to run on a single device or to connect to a server running on a separate phone over a network. The most common types of servers were database servers, file servers, SMTP servers, print servers, server software, game servers, and server software.
To know more about Server:
https://brainly.com/question/7007432
#SPJ12
With partial dependencies, data redundancies occur because every row entry requires duplication of data.
a. true
b. false
Answer: Option A) True
Explanation:
A partial dependency can exist only - if a table's primary key is composed of several attributes, if a table in 1NF has a single-attribute primary key, then the table is automatically in 2NF. Therefore, with partial dependencies, data redundancies occur because every row entry requires duplication of data.
based on the description that follows, how many potential insider threat indicator(s) are displayed? a colleague enjoys playing video games online, regularly uses social media, and frequently forgets to secure your smartphone elsewhere before entering areas where it is prohibited.
The numbers of potential insider threat indicator(s) that are displayed in the statement is 1.
What might give rise to insider threats?An insider threat can occur when a close associate of a company who has been granted access abuses it to harm the company's vital data or systems. This person doesn't necessarily have to be an employee; other partners, contractors, and third-party vendors could also be dangerous.
Note that Behavioral insider threat potential indications, for instance, an insider might display abrupt behavioral changes, such as an increase in absences or tardiness, or a decline in work performance. They might also suddenly need money or show an odd interest in confidential company secrets. Hence it is one which is not keeping the smartphone elsewhere.
Learn more about potential insider threat from
https://brainly.com/question/14377557
#SPJ1
Elapsed time an item spends moving through a process from start to finish is called...
Lead time is the amount of time an item takes to complete a procedure from beginning to conclusion.
Takt time is the average length of time that elapses between the start of the manufacturing of two subsequent product units. Lead time, as used in inventory management, describes the interval between a customer's request for a good or service and the moment the order is delivered. Lead Time is the amount of time a client must wait between making an order and receiving a product or service. In other words, it is the average amount of time required for a product or unit to move from the point of entry to the point of exit, delays included. The delivery lead time is for the good or service.
Learn more about product here-
https://brainly.com/question/20362720
#SPJ4
write a function that takes a number as its argument and * returns a string that represents that number's simplified fraction.
Following is the program:
const hcf = function(num1, num2) {
return !num2 ? a : hcf(num1, num1% mum2);
}
const toFraction = function(number) {
const numberToArray = number.toString().split('');
let denominator, numerator;
if (numberToArray.length === 1) {
denominator = 1;
numerator = Number(numberToArray[0]);
} else {
// delete demical point //
numberToArray.splice(numberToArray.indexOf('.'), 1);
denominator = Math.pow(10, (numberToArray.length - 1));
numerator = Number(numberToArray.join(''));
}
const fractionHCF = gcd(denominator, numerator);
const result = (numerator / fractionGcd) + '/' + (denominator / fractionGcd);
return result;
};
console.log(toFraction(3.0))
console.log(toFraction(2.5))
console.log(toFraction(3.0))
console.log(toFraction(2.14)) /* 107/50 */
console.log(toFraction(5.6505)) /* 11301/2000 */
console.log(toFraction(25.0504)) /* 31313/12500 */
Hence to conclude above is the required program for a function that takes a number as its argument and returns a string that represents that number's simplified fraction.
To know more on functions follow this link
https://brainly.com/question/25638609
#SPJ4
Which verb tense is used in the following sentence?
As the captain, I represent the team at all debates.
O present tense
O future tense
past tense
O early tense
Answer:
present tense
Explanation:
if it were future, he would say "I will represent the team"
if it were past tense, he would say "I represented the team"
What are three modern products that would not be available without tesla’s contribution to the field?.
The electric motor, long-distance power transmission, radio, robots, and remote control were all inventions by Nikola Tesla that laid the groundwork for our contemporary economy.
Numerous technologies that are essential to our daily lives were developed by Tesla, predicted by him, or as a result of his work, including the remote control, neon and fluorescent lighting, wireless transmission, computers, smartphones, laser beams, x-rays, robotics, and, of course, alternating current, the foundation of the modern world. In response to this, Tesla created a miniature boat that he could control using radio signals to start, stop, and navigate. "Battle ships [sic] will cease to be built and the most tremendous artillery afloat will be of no more use than so much scrap iron," he hoped, by eliminating humans from the picture.
Learn more about computer here-
https://brainly.com/question/16348788
#SPJ4
In network, what does sidney lumet imply about the differences between the goldenera of television and what it has become?.
"Network" is a film about television news, but its creators also used it as a platform to bemoan the industry's deterioration since its first Golden Age (thus the reality television-like "Mao Tse Tung Hour" subplot in the film). As "Network" predicted, a TV network would sanction a murder in exchange for ratings.
What is Network?
Two or more computers connected together to share resources (such printers and CDs), exchange files, or enable electronic communications make up a network. A network's connections to its computers can be made by cables, phone lines, radio waves, satellites, or infrared laser beams.
In this well-known parody, veteran news anchorman Howard Beale (Peter Finch) finds that he is being put out to pasture and is not thrilled about it. Instead of following through on his live television threat to hurt himself, he lets out a televised scream of wrath that significantly boosts the UBS network's ratings. With this trick, ambitious producer Diana Christensen (Faye Dunaway) can produce even more controversial shows, which she does to alarming lengths.
Learn more about Network click here:
https://brainly.com/question/28041042
#SPJ4
how to implement a password policy
The following steps are to be followed to implement a password policy:
1. ENFORCE PASSWORD HISTORY
2. SET MAXIMUM PASSWORD AGE
3. SET MINIMUM PASSWORD AGE
4. SET COMPLEXITY REQUIREMENTS
5. CREATE A PASSPHRASE
6. IMPLEMENT MULTI-FACTOR AUTHENTICATION
What is a password policy?
By encouraging users to adopt secure passwords and to use them appropriately, a password policy is a set of guidelines meant to improve computer security. A password policy is frequently included in an organization's formal rules and may be covered in security awareness training. A rule that a password must abide by is the rule of password strength. For instance, a minimum of five characters may be required under laws governing password strength.
To learn more about password policy, use the given link
https://brainly.com/question/28114889
#SPJ4
one thing to watch out for is compiler optimization. compilers do all sorts of clever things, including removing loops which increment values that no other part of the program subsequently uses. how can you ensure the compiler does not remove the main loop above from your tlb size estimator?
You can ensure the compiler does not remove the main loop above from your TLB size estimator by using GCC's optimize option gcc -O0 to disable the optimization. This is the default setting.
What is a compiler in programming?A compiler is a specific software that converts the source code of a computer language into machine code, bytecode, or another programming language. Typically, the source code is written in a high-level, human-readable language such as Java or C++.
Compliers are classified as follows:
Compilers that cross-compile. They generate executable machine code for a platform that is not the platform on which the compiler is operating.Compilers for Bootstrap These compilers must compile a programming language into which they are written.Decompiler. Source to source/transcompiler.Learn more about compilers in programming:
https://brainly.com/question/28232020
#SPJ1
the disjoint set data structure will be used in the creation of a maze. the algorithm to do this is discussed in the textbook in chapter 8. details: write a program to generate and display a maze as described in the textbook. the program may either be a command-line program that generates a character-based maze, or it may be a gui program that draws the maze in a window. the user should be able to specify the number of rows and columns in the maze, at least up to 20x20. you must use the disjset class from the textbook to implement the textbook's algorithm. the disjset class must be used as given in the textbook without making modifications to it. since this problem is one from the textbook, it is likely that there are solutions on the internet for it, however, you may not use solutions from the internet in any way on this project. all work must be your own.
Using the knowledge in computational language in JAVA it is possible to write a code that generate and display a maze as described in the textbook.
Writting the code:import java.awt.*;
import javax.swing.*;
public class MazeSolver extends JPanel implements Runnable
{
public static void main(String[] args)
{
JFrame maze = new JFrame("Maze Solver Game");
maze.setContentPane(new MazeSolver());
maze.pack();
maze.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
maze.setVisible(true);
}
//Take an array named mazeSolver
int[][] mazeSolver;
//creates clr as object of Color class
Color[] clr;
//Number of rows either it is wall or edge
int row = 31;
//Number of columns either it is wall or edge
int col = 41;
//Number of moves between edges and maze
int border = 0;
//time to wait
int timer = 5000;
//Delay to solve maze
int delay = 30;
//size of the block
int size = 12;
//To check whether maze exists or not
boolean MazeComplete = false;
//Sets the backcolor
final static int backcolor = 0;
//Generates walls
final static int walls = 1;
//NextMove used to move to the next step
//either there is path or wall
final static int nextMove = 2;
//WaitingToMove means the path that is
//not visited but it is to be visited
final static int WaitingToMove = 3;
//Means compiler moves from this path but
//did not get the solution
final static int Unsolvedvisit = 4;
//Panel width and height
int wd = -1;
int ht = -1;
//width and height of the panel minus border area
int width;
int height;
//Left and top edges to move
int leftmove;
int topmove;
//Construtor of MazeSolver class
public MazeSolver()
{
//Sets the color to the Maze
clr = new Color[] {
new Color(200,0,0),
new Color(200,0,0),
new Color(128,128,255),
Color.WHITE,
new Color(200,200,200)
};
//Sets background color of the mazeSolver
setBackground(clr[backcolor]);
//Sets size of the mazeSolver
setPreferredSize(new Dimension
(size*col, size*row));
//Start the new thread
new Thread(this).start();
}
//Method mazeSize() to check the size
void mazeSize()
{
//Sets the parameter before call
if (getWidth() != wd || getHeight() != ht) {
wd = getWidth();
ht = getHeight();
int w = (wd - 2*border) / col;
int h = (ht - 2*border) / row;
leftmove = (wd - w*col) / 2;
topmove = (ht - h*row) / 2;
width = w*col;
height = h*row;
}
}
//call protected method paintComponent()
synchronized protected void paintComponent(Graphics g)
{
//Call the parent class paintComponent() method
super.paintComponent(g);
//Call the mazeSize() method.
mazeSize();
//Call draw() method
draw(g);
}
//Define draw() method to draw the maze structure
void draw(Graphics g)
{
// Checks whether maze exists or not
if (MazeComplete)
{
//calculated width of Maze
int w = width / col;
//calculated height of Maze
int h = height / row;
//loop to set color in the complete maze
//either it is visiting or looking for
//path or here is no path to move
for (int j=0; j<col; j++)
for (int i=0; i<row; i++) {
if (mazeSolver[i][j] < 0)
g.setColor(clr[WaitingToMove]);
else
g.setColor(clr[mazeSolver[i][j]]);
g.fillRect( (j * w) + leftmove,
(i * h) + topmove, w, h ); }
}
}
//Run() method solves the maze problem
public void run()
{
//start try-catch block
//Thread wait for a bit
try { Thread.sleep(1000); }
catch (InterruptedException e) { }
//creates maze and call for the solution
while (true)
{
createMaze();
synchronized(this)
{
//try-catch block
try { wait(timer); }
catch (InterruptedException e) { }
}
//Maze solution is false, after checking
//means no solution exists
MazeComplete = false;
repaint();
}
}
//createMaze() method
void createMaze()
{
if (mazeSolver == null)
mazeSolver = new int[row][col];
int i,j;
int rooms = 0;
int square = 0;
int[] wall1 = new int[(row*col)/2];
int[] wall2 = new int[(row*col)/2];
for (i = 0; i<row; i++)
for (j = 0; j < col; j++)
mazeSolver[i][j] = walls;
for (i = 1; i<row-1; i += 2)
for (j = 1; j<col-1; j += 2)
{
rooms++;
mazeSolver[i][j] = -rooms;
if (i < row-2)
{
wall1[square] = i+1;
wall2[square] = j;
square++;
}
if (j < col-2)
{
wall1[square] = i;
wall2[square] = j+1;
square++;
}
}
MazeComplete = true;
repaint();
int n;
for (i=square-1; i>0; i--)
{
n = (int)(Math.random() * i);
setPath(wall1[n],wall2[n]);
wall1[n] = wall1[i];
wall2[n] = wall2[i];
}
for (i=1; i<row-1; i++)
for (j=1; j<col-1; j++)
if (mazeSolver[i][j] < 0)
mazeSolver[i][j] = WaitingToMove;
}
synchronized void setPath(int row, int col)
{
if (row % 2 == 1 && mazeSolver[row][col-1]
!= mazeSolver[row][col+1])
{
fill(row, col-1, mazeSolver[row][col-1],
mazeSolver[row][col+1]);
mazeSolver[row][col]=mazeSolver[row][col+1];
repaint();
try { wait(delay); }
catch (InterruptedException e) { }
}
else if(row % 2 == 0 && mazeSolver[row-1][col] !=
mazeSolver[row+1][col]) {
fill(row-1, col, mazeSolver[row-1][col],
mazeSolver[row+1][col]);
mazeSolver[row][col]=mazeSolver[row+1][col];
repaint();
try { wait(delay); }
catch (InterruptedException e) { }
}
}
void fill(int r, int c, int from, int to)
{
if (mazeSolver[r][c] == from)
{
mazeSolver[r][c] = to;
fill(r+1,c,from,to);
fill(r-1,c,from,to);
fill(r,c+1,from,to);
fill(r,c-1,from,to);
}
}
}
See more about JAVA at brainly.com/question/12975450
#SPJ1
In the ________ phase of the sdlc, developers identify the features and functions needed in the new system.
In the system definition phase of the sdlc, developers identify the features and functions needed in the new system.
What is SDLC?
A organized procedure known as the Software Development Life Cycle (SDLC) provides the fastest possible production of high-quality, low-cost software. Producing top-notch software that meets and surpasses all client expectations and needs is the aim of the SDLC.
To efficiently create and manage applications, the SDLC process entails planning, designing, developing, testing, and deploying with ongoing maintenance.
Planning and research. Designing the architecture of the product.Coding and developing.In testing.Maintenance.The current system development life cycle consists of seven key phases. Here is a quick summary:
Planning Stage Feasibility or Analysis RequirementsDesign and prototyping,Software development, Software testing, Implementation, and integration are the stages.Operations and Upkeep StageLearn more about SDLC click here:
https://brainly.com/question/7302480
#SPJ4
traffic engineers and lawmakers have designed our roads, laws and traffic controls to help drivers what other road users are about to do.
Traffic engineers and lawmakers have designed our roads, laws, and traffic controls to help drivers to predict the actions of other road users.
What are traffic rules?Traffic is made up of all the people and things that use public spaces to get from one location to another, including vehicles, bikes, horses, and other ridden or herded animals.
In order to prevent accidents, it's crucial to adhere to traffic laws. Since accidents are one of the main causes of death worldwide. By taking responsibility and behaving responsibly, many lives can be saved.
Therefore, our roads, laws, and traffic signals were created by traffic engineers and legislators to aid drivers in predicting the activities of other road users.
To learn more about traffic rules, refer to the link:
https://brainly.com/question/26273760
#SPJ1
what information is used by a process running on one host to identify a process running on another host?
The port number of the socket in the destination process and the destination host's IP address.
What is IP address?
Any device on a network can be identified by its IP address, which stands for Internet Protocol. IP addresses are used by computers to connect with one another on different networks and the internet.
What is Port number?
An internet message or other network communication that arrives at a server can be redirected to a specific process by using the port number. All network-connected devices have standardized ports with a unique number installed.
A client submits a request of some kind to a server running on a different system, and the server reviews the request, acts on it in some way, and then might deliver some form of data back to the client. This fundamental concept is used by nearly all IP applications. Although this isn't always the case (many UDP-based "servers" simply monitor network activity and don't really return any data), it is true for the majority of applications.
Learn more about IP address click here:
https://brainly.com/question/14219853
#SPJ4