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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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