********** NOTE CHANGE OF MIDTERM DATE ON COURSE PAGE **********
You will need to be able to run Ruby to complete this week's homework. I would recommend SciTE for those running on windows. I personally use TextPad and can give you pointers on how to set it up if interested. But SciTE should work fine for you.
If you are running on a mac, I don't have advice other than to google "ruby IDE on mac" and see what you turn up.
We will transition from one abstraction level (Turing Machines) to another (programming in Ruby). To smooth this transition, we will stay with the same problem we were working on in the TM, i.e., simulation of the full-adder. I will give you two almost correct versions of the full-adder in Ruby. One version uses a fairly standard rule/procedural approach, what I have been calling "old school" in class. The other version uses what I think you will see in the future, a form of "cloud computing". Both do the job, but use different means to get work done.
I introduced a 4 step process for dealing with programming problems in class last week: (1) figure out what the goal is, (2) write test cases and results you expect from each, (3) build your program incrementally to satisfy the test cases, and (4) declare victory when all the test cases give the results you expect. We will continue that process this week with Ruby. Step 1 is to simulate the full adder. And the good news for step 2 is that I have already set up the test cases for you. And more good news is that I have done a lot of work on step 3 for you, and will give you what I have done. Your job will be to continue to work on step 3 until you get to step 4. And I almost forgot, you will have to do this for both rule and cloud versions.
I did not assign a Ruby book because I don't find any that are suited to our class. What I will try to do is give you examples to work from. I will also suggest you make heavy use of google (e.g., google "ruby case" to get info on the rules version of the FA program). You might also want to try http://www.ruby-doc.org/docs/UsersGuide/rg/index.html and see if you like it. And of course Victor and I will answer questions.
As a start, here are two versions of a Ruby program for computing factorials, along with the test-case program for each. I am including these so you can look at finished products and see how they are constructed. You will be able to use some of the same pieces in your assignment.
Your homework assignment runs somewhat parallel to the factorial programs above. I will give you two versions of a program/method. But instead of recursion and iteration versions, I will give you rule and cloud versions. But same idea: both compute the same thing using diffent techniques. I will also give you associated test-file programs. The problem is that the two versions are not quite complete: some test cases still fail. Your assignment is to modify the versions so that all test cases succeed. BTW: you cannot change the test-case files. Your customer gave them to you as what he or she wanted to happen, and would not be happy with you if you changed the problem to suit your needs!
A tool you might find useful is fxri that comes with the Roby download (at least on the windows version). When you start the tool, it gives you an interactive window. You can type Ruby code in this window to see what happens. It's a good place to try out ideas before committing them to the program in your file. For instance, here is a little bit of me playing around with fxri. The tool gives you feedback after the => symbol.