I:\CSC424\public\SimpLan2\
in your own folder on the
I:
drive (or in a shared workshop folder if you are working with
a partner). Turn in a print-out of the files you modified, plus a collection
of SimpLan programs that test your new feature.Wheels - cost 2 - 1 4 - 4 ...Note: Since we did not learn about support for floating point numbers in Forth, either do the calculation in cents (so the first cost above would be 100, etc.) or calculate the cost by dividing by 4 instead of multiplying by 0.25.
startAnimation
:
startAnimation path := OrderedCollection new. p := 0@0. self move: 10 stepsBy: 0@10. self startStepping.This function should do the same thing as the original (except for bouncing the ball back, since there is no reverse of the path here). Add code to complete this by writing the
move: stepsBy:
function, then add
a few more lines to startAnimation
to make your object move in
a square. Hint: you may also have to change the class definition to get this
to work. If you have any questions, feel free to direct them to
Kyle,
Matt, or
Andrew.
ubercalc[framework].erl
and ioserver.erl
from the folder
I:\CSC424\workshop\Erlang
into the Erlang folder of your
installation (this will be C:\Program Files\erl5.3
if you did a
default install); change the name of the first file to
ubercalc.erl
. Add code to the server/1
function in
the ubercalc
module such that when the server receives a message
of the form {'+',A,B}
, it will add the numbers A
and
B
and send a message containing the result to the I/O process.
It should also be able to handle multiplication, division, subtraction, and
modulus in the same way. Your project will also need to have a
stop
clause on the receive loop, so that the calculator can be
turned off when you're done using it. When finished, the project will be run
from the Erlang command prompt:
c(ubercalc). % compile ubercalc.erl c(ioserver). % compile ioserver.erl ioserver:start(io). % start an instance of ioserver, named io ubercalc:start(calc, io). % start an instance of ubercalc, named calc calc ! {'+', 12, 34}. % should cause 45 to be printed ... calc ! stop. % stop the calculator server
(sum '(1 2 3 4 5)) -> 153
(sum '(14 8 7)) -> 87178336560
directFlight(chicago,warsaw). directFlight(vancouver,chicago). directFlight(newyork,toronto). directFlight(toronto,chicago). directFlight(warsaw,cancun). directFlight(alicante,newyork). directFlight(miami,alicante).That is, this knowledge base holds facts about cities it is possible to travel between by taking a direct flight. But of course, we can travel further by `chaining together' direct flight journeys. Write a recursive predicate
travelBetween
that tells us when
we can travel by plane between two cities. For example, when given the query
travelBetween(miami,warsaw).it should reply "yes".
March 17 | Icon | Brolsma & Hammes |
March 31 | Forth | Betz & Whitaker |
April 7 | JavaScript | Moore & Pease |
April 14 | Ada | Harris & Tannenholz |
April 21 | Smalltalk | Shipley, Stone & Thomas |
April 28 | Erlang | Colvard & Haas |
May 5 | Lisp (Scheme) | Bryan & Vlahov |
May 12 | Prolog | Grossnickle & Macleod |