Application in pascal language for free pascal compiler , Programming Languages

Assignment Help:

Before I describe what you are supposed to do, please remember that this programming assignment is NOT a group project. You are NOT allowed to do this with anyone else's help. This assignment should be done COMPLETELY on your own. If you have questions, Don't contact anyone else and don't search the web for a solution.

Your program should use the Free Pascal compiler or the Lazarus IDE described in CSC 540. When you hand in your assignment to the digital dropbox, it should be a .PAS file, not zipped.

In the following scenario, X, P, M and N are used, but not defined. They will be defined later in this specification.

Imagine a "forest" represented by a square grid that measures X units on each side. (The units could be yards or kilometers... I don't care.) There are P players. P must be at least 2. The first player is placed at the lower left corner of the grid. Each player is placed on the edge of the playing field, evenly spaced apart counting the grid points along the outside of the square grid. If there are two players, they are on opposite corners. If there are four players, there is one player at each corner at the start of the game. If there are three players, the first player is at the lower left, the second player is somewhere on the right edge of the grid, and the third player is somewhere on the top of the grid. You place these players by dividing the perimeter of the playing field to get the distance between the players, placing the first person at the lower left corner, and playing the rest at the appropriate place around the perimeter.

The players cannot see or hear each other. At each tick of the clock (the clock may measure hours or milliseconds or years... I don't care), a player moves. The first player moves first, the second player second, until all players have moved; then that rotation starts over again. Each player moves in the following way: an integer D between 1 and 4 inclusive is chosen; 1 means north (up on the grid), 2 means west, 3 means south, and 4 means east. A second integer L is chosen between 1 and M. The selected played moves in the direction specified by D, the number of units specified by L. However, if the player's next step would take her off the grid, then she stops at the edge and her turn is over.

If at the end of a turn, the player who moved is in the same piece of the grid as another player, then the player who moved has "tagged" the other player, and wins the game. When this happens, that game is over, and a new game begins. The player who tagged the other player gets one point. Then you put the players back into their original positions, and start the game again. You keep playing until T time units have gone by; then you stop and record your data.

Each time you simulate this, you will set X (the size of the grid), P (the number of players), T (the maximum number of turns) and M (the maximum number of steps to take during a turn). Make sure your P players can fit on the outside of the grid; that is, P <= 4*X. You also probably want to have at least one tag when you run M turns, so make T big enough so that at least one tag occurs before T steps are done; more than one is even better. After each round of T turns, stop the simulation and record your results.

Your "results" should include how many points total were scored after T time steps, and how many points are scored by each player during that time. Also keep track of how many turns happened before someone got tagged, so you can keep track of the smallest, largest and average number of turns required to get a tag.

You have four variables that can serve as an independent variable: X, P, T and M. Fix three at a time, and change the fourth; then graph the things you measure on one or more graphs. For example, you could fix X at 10, fix P at 2, fix T at 1000000, and run one simulation for M=1, another simulation for M=2, and more simulations at M = 4, 8, 16, 32, and 64. Compare the measurements on a graph or graphs. Do the trends on the graph make sense to you?

Next, fix X, P, and M at numbers you think are reasonable, and change T to 10^3, 10^4, 10^5, 10^6, and 10^7. This gives you more data to graph. Look for patterns. If no one ever gets tagged, change X or P to increase the number of tags. If too many tags to take, again change X or P.

You can also fix X, T, and M and change P to get another set of data. Finally, you could fix P, T, and M and change X. Each time you collect and display your data, look for interesting trends.

This should give you plenty of interesting data for your next homework assignment.

Be careful to use qword instead of int variables for the appropriate declarations since some of these numbers will be way over 32,767 (the limit of a Pascal int).

Also, while you are debugging your program, it is wise to print out to the screen frequently so you can see what's going on (and perhaps what's going wrong!). But once you start running programs that do LOTS of calculations, then do input and output sparingly; input and output require FAR more time than other calculations, and you want simulations doing millions of trials to go quickly, not slowly.

create a PowerPoint presentation that reports on your simulations and results.


Related Discussions:- Application in pascal language for free pascal compiler

3-Tier Architecture in asp.net, I am getting error at business layer object...

I am getting error at business layer object in code behind page.

Small code have missing part, #question. /* * * * * * * * * * * * * * * * *...

#question. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Description: *

Matlab, Determine the moment of force about the point where a bracket is at...

Determine the moment of force about the point where a bracket is attached to a wall. the bracket is shown in figure attached. it extends 10 inched out from the wall and 5 inched up

.net windows services, .NET Windows Services But Enthusiasm has an amazi...

.NET Windows Services But Enthusiasm has an amazing record of beginning overdue but finding up easily. This is real in situation of .NET too. Enthusiasm put their best men at

Advantages of java stored procedures, Advantages of java stored procedures ...

Advantages of java stored procedures Transactions Although a saved process contains SQL orders, once collected it will socialize with SQL Hosting server very diversely from

Program 3, An apartment complex has several apartments to rent. The apartme...

An apartment complex has several apartments to rent. The apartments are all similar, and all rent for $750 per month. Currently, all units are occupied. The management, being in bu

Create procedures for accessing the root, (a)  Create procedures for access...

(a)  Create procedures for accessing the root, left subtree and right subtree, and also mutators for changing the root, left subtree and right subtree of an avl argument. (b) Wr

#Linux, Hi Dehren, Below is the assessment question for the linux:  Task Y...

Hi Dehren, Below is the assessment question for the linux:  Task Your job in this assignment is to create two Virtual machines each running a different but the latest distribution

Example problem of modularity, Example problem Imagine that  you  requ...

Example problem Imagine that  you  require  to create  a robot  that  will  roll up  close to a light  lamp  and  stop  a fixed distance from it.  The first question is, how w

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd