Develop a domain-specific language within ruby

Assignment Help Programming Languages
Reference no: EM13522980

Your paper can be either an investigation or a survey. If the former, your paper should present an interesting problem or technique relating to object orientation. It should state the problem, provide background and motivation, and describe novel approaches (proposed by others or by you). Your paper might or might not require programming, depending on its focus. Alternatively, if you write a survey, it should be based on key papers related to the area you choose. Regardless of whether your paper is an investigation or a survey, it should include key references and should run about 12-16 double-spaced pages in length.

In addition to the resources cited in the bibliography section of our course syllabus, use NSU's online databases, particularly the ACM Digital Library, IEEE Computer Society Digital Library, and ScienceDirect.

Programming project

Develop an interesting program in Ruby. Possible projects:

- Significantly enhance one of the programming assignments from this course.

- Develop a game, such as a board, adventure, word, or computer game.

- Develop a domain-specific language (DSL) within Ruby, such as for manipulating files in a directory system, editing files, generating quizzes, describing graphical or geographical scenes, and adding and viewing entries in a calendar.

- Develop useful metaprogramming tools, similar to the attr_* class methods, or the methods defined in the Forwardable or Singleton modules.

Elevator project

Develop a simulation of an elevator that travels between floors 1 and N where N is an input. Time is sequenced in discrete steps starting at 1; at each time step, the elevator may ascend one floor, descend one floor, or remain at its current floor, as determined by its strategy. The first line of the input file indicates the number N of floors. This is followed by one line per person using the elevator: her id, call time (when she calls for the elevator), origin floor (where she boards the elevator), and destination floor (where she debarks the elevator). For example:

1628_Develop a domain-specific language within Ruby.png

Here, individual 100 boards at time 2 from floor 1 with a destination of floor 4. Assume sensible inputs (e.g., times are positive integers, floors are integers in the range 1 through N).

Whenever the elevator stops at a floor from which people have called it (i.e., their origin floor but not before their call time), they all board the elevator. And whenever the elevator stops at any passengers' destination floor, they all get off the elevator. (Everyone behaves so as to minimize their travel time.) The simulation stops when every individual has been brought to their destination floor (subject of course to their call time and origin floor constraints).

A strategy determines the floor the elevator begins on at time 1, and a policy for moving to the next floor (up one floor, down one floor, or remaining at the current floor) from one time step to the next. Here is a simple strategy:

Strategy 1: Start at floor 1. In each time step, successively go up one floor until reaching the top floor N, then successively go down one floor until reaching the bottom floor 1, and continue this ‘up to the top floor then down to the bottom floor' policy.

We measure the efficiency of a strategy with respect to the passengers' average wait time. Let's say that someone's wait time is the number of time steps from her call time until she reaches her destination floor. So wait time is the time waiting for the elevator to arrive at the origin floor plus the time traveling in the elevator to the destination floor. For example, the wait times for customers 100 through 104 are 10, 2, 5, 4, and 7, respectively. Then we define the efficiency of a strategy (with respect to input) to be the average wait time over all customers. Our simulation reports this value for the simulation just run:

>> puts sim.average_wait_time
5.6

Here is what you need to submit:

1. A scenario diagram for the case where a customer calls the elevator, the elevator arrives, she boards, the elevator moves (over time) to her destination floor, and she debarks. You may devise other diagrams but this one is essential. You are welcome to discuss and work on your design on our discussion board and during class time (but you should implement the project on your own).

2. Implement Strategy 1 as part of your project. In addition, devise and implement a second strategy that is generally more efficient than Strategy 1. Where sim is a Simulation object, we run a simulation like this:

sim.run(filename_string, strategy_symbol)

The symbol :strategy2 should identify your (more efficient) strategy.

3. Write a method

sim.multirun(nbr_runs, filename_prefix, strategy)

that runs your program nbr_runs many times on the input files named by filename_prefix with suffixes 000.in, 001.in, ..., and returns the average efficiency. For example:

sim.multirun(15, 'myelev', :strategy2)

runs your Strategy 2 on the files myelev000.in, ..., myelev014.in and returns the average of the 15 efficiency values. I will give you a set of input files to test your program on, and you should report the average efficiency you obtain on these files for both strategies. You can also use these input files to compare your strategy to other strategies, with respect to efficiency. I'll also give you a short Ruby program to generate your own test files.

4. Submit your Ruby code for this project, in addition to your scenario diagram, in a zip archive by the due date.

An opportunity for discussion and presentation of projects toward the end of the term. We have too large a class to allow everyone to give a presentation, but those of you who wish to give one.

Reference no: EM13522980

Questions Cloud

Calculate how far apart are the charges : Two charges of equal magnitude exert an attractive force of 7.5×10-4 N on each other. If the magnitude of each charge is +2.4? C, how far apart are the charges
Plano uses a weighted average costing system. : Plano uses a weighted average costing system.
What is the magnitude of the charges : Two identically charged particles separated by a distance of 5.7 m repel each other with a force of 8.9 N. What is the magnitude of the charges
Explain sodium hydroxide the equivalence point : Calculate the Ka of an unknown monoprotic acid. When 15 mL of the acid was titrated with 28 mL of 0.15 M sodium hydroxide the equivalence point was reached at a pH of 8.48.
Develop a domain-specific language within ruby : Develop a domain-specific language within Ruby, such as for manipulating files in a directory system, editing files, generating quizzes, describing graphical or geographical scenes, and adding and viewing entries in a calendar.
What is the sign and magnitude of the charge on the block : A very small charged block with a mass of 2.10 g is placed on an insulated, frictionless plane inclined at an angle of 17.0° with respect to the horizontal, What is the sign and magnitude of the charge on the block
Discuss the beginning of western philosophy : Discuss the beginning of western philosophy (you need to give a few examples). How is philosophy distinct from other disciplines? Do you think the beginning of western philosophy is the right way to go about thinking about our lives (not in their ..
Obtain the final charge on each object : Four identical metallic objects carry the following charges: +1.18, +6.89, -4.92, and -9.56C. The objects are brought simultaneously into contact, What is the final charge on each object
Explain a buffer was prepared by ammonium nitrate : A buffer was prepared by adding 2.4 g of ammonium nitrate to 100 mL of 0.30 M ammonia (Kb = 1.8 x 10^-5). To this solution was then added 10.0 mL of 0.30 M sodium hydroxide, what is the new pH

Reviews

Write a Review

Programming Languages Questions & Answers

  Make the class employee to initializes three data members

Make the class called Employee which comprises three pieces of information as data membersa first name (type string), last name (type string) and monthly salary (type int).

  Write a program that exploit string library functions

Write a program that exploit string library functions to do the following: -prompt the user to enter his name (of four parts) -count the number of characters in his name (excluding the white spaces).

  Develop a simple program for inventory system

You have to develop a simple program for an inventory system. You can choose any type of business (ie: Medical supplies, bakery, grocery shop, florist etc.)

  Provide a brief description within comment tags

Produce a description of the modules you have studied so far on this degree in an HTML5 file and an external CSS file that will display

  There is two part in this assignment1-discussion1-what does

there is two part in this assignment1-discussion1-what does ethics have to do with recruiting and please define ethics?

  Write class to hold hourly rate of pay

Write down the class which comprises variables which hold your hourly rate of pay and number of hours that you worked. Illustrate your gross pay.

  Method to pass string argument and returns first line

Write a method, getFirstLine, that is passed a String argument and that returns the first line.

  Create function m-file called mass that requires two vector

Create a function M-file called mass that requires two vector inputs-the number of moles and the molecular weight-and returns the corresponding mass. Because you are providing vector input, it will be necessary to use the meshgrid functio..

  Design getter and setter and constructor methods

User must have option to draw new shape at different location and keep the existing shape. Design all the getter and setter & constructor methods for each class.

  Write a program to compute the probability

Write a program (or a peudocode) to compute the probability that at least 2 people have the same birthday, given there are 2, 3, 4,....,60 people in the room.

  Write a function calculating the length of the hypotenuse

(Hypotenuse Calculations) Write a function calculating the length of the hypotenuse of a right triangle (have two sides already). Determine the length of the hypotenuse for each of the given triangles.

  Create application which permits user to input a price

Create an application which allows a user to input a price until suiatble sentinel value is entered. Output is a price of each item on each day,one through seven.

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