# **Program must be written in Pascal ** Imagine there is white board. You draw non-intersecting circl

**Program must be written in

**Pascal**** Imagine there is white board. You draw non-intersecting circleson the board, numbered 1 to N, where N is an integer from 2 to 10.You next draw arrows from one circle to another, making sure thateach circle has at least one out arrow and one in arrow. Now youplay the following “game:” 1. Place a magnetic marker in circle #1, and put a check mark incircle #1. The circle where the marker resides is called the“current circle.” 2. Randomly choose among the out arrows in the current circle.(If there is only one out arrow, that choice is trivial.) In thisselection, all the out arrows should be equally likely to bepicked. 3. Move the marker to the circle pointed to by the out arrow.This becomes the new current circle. 4. Put a check mark in the current circle. 5. If all the circles have at least one check mark, stop thegame. If not, go to step 2 and repeat. The program will read from a textfile in the same directory asthe executable program, and will write to another textfile in thatsame directory. Let N and K be positive integers. For this assignment, N isbetween 2 and 10 inclusive. The input text file should be namedProj1.txt. It should be in this form: The first line has only the number N, the number of circlesthat will be used in your game. The second line has the number K, the number of arrows you will“drawing” between the circles. The next K lines designate the arrows, one arrow per line. Eacharrow line consists of two numbers, each number being one ofcircles in the game. These two numbers are separated by a singleblank. The first number designates the circle that is the source(back end) of the arrow; the second number designates the circlethat is the destination (pointed end) of the arrow. The circles andarrows of this game describe a directed graph, sometimes known as a“diagraph.” In order to set up the game correctly, you shoulddescribe a “strongly connected diagraph.” A diagraph is stronglyconnected when there is a path between any two nodes. In our game,our paths are the arrows, and our nodes are circles. Make sure that you test it with circles and arrows that describea strongly connected digraph. Not all circles need to be connecteddirectly to each of the other circles; but as a system, they shouldbe connected in the sense described above. I suggest that each timeyou make a new Proj1.txt you draw the desired game board and thentranslate into the required input file. Shown below are three systems of circles and arrows. Withrespect to the definition of “connected” above, NOT ONE of them isstrongly connected. In Figure 1 and Figure 3, you could make thedigraph strongly connected by adding an arrow from circle 4 tocircle 1. The reason we need strong connection is so that you don’tget “stuck” in your random walk around the digraph. Figure 1. This system is not strongly connected; there is nopath to circle 1. If you add an arrow from circle 4 to circle 1, itwould be strongly connected. Figure 2. This system is not strongly connected. Once you followan arrow, you are stuck. Figure 3. This system is not quite strongly connected; an addedarrow from circle 4 to circle 1 would make it stronglyconnected. Your program can assume this connectedness for a given inputfile. That is, your program need not verify that the circles andarrows described in the input file form a strongly connecteddigraph. A subsequent assignment will require your program toverify the connectedness. If the text in the input file does not follow the formatdescribed above, your program should end with an error message tothe screen and to an output file. The output file should be atextfile. Name your output textfile “Ass1.txt” where “lastname” isreplaced by your last name. If the text in the input file DOES follow the description above,then you should play the game until each circle has at least onecheck. When that happens, the game stops. At the end of the game,you should print out to the screen, and to the output textfile, thefollowing numbers: 1. The number of circles that were used for this game 2. The number of arrows that were used for this game 3. The total number of checks on all the circles combined. 4. The average number of checks in a circle marked during thegame. 5. The maximum number of checks in any one circle. All of these numbers should be labeled clearly in both outputs,with explanations sufficient for someone who knows only vaguelywhat’s going on with this strange game. Attached