<- Back to Quoridor Project Page
This is my report.
My original proposal
How each objective was met
1. Porting my Allegro LISP Quoridor game-player to Borland C++
Builder
2. Documenting the primary differences in code and data strucures.
3. Improving upon the implementation in instances of poor original
design.
4. Analyzing several differences between the two languages.
5. Comparing the efficiency of the two implementations.
Areas of study
Differences in Code Structure
Differences in Project Feasibility
Porting my Allegro LISP Quoridor game-player to Borland C++ Builder
After spending some time with the environments of Visual C++
and C++ Builder, I felt that the Borland environment was more intuitive. (In my opinion, it
has a "feel" very much like Visual Basic, so it may be "intuitive" to VB users...) So I
chose Borland's C++ Builder over Microsoft's Visual C++.
Differences between Lisp and C++
I don't believe that my recognition of these obvious differences
approaches "analysis," but the immediately obvious difference between C++ and Lisp is C++'s
inability to naturally handle "cars" and "cdrs." C++ must be taught to handle these tools,
which are the foundation of the Lisp programming language. I "taught" C++ about "cars" and
"cdrs" by writing a linked-list class. This class is here (first
version C++), and here (second C++ version).
Other than that, the only differences that really struck me were
Lisp's use of "nil," and C++'s very, very handy incrementing tool- the "++"
symbol.
Comparing the efficiency of the two implementations.
The C++ version is much faster than the Lisp version, but
that is largely due to the differences between Borland's and Allegro's GUI handling.
Furthermore, our version of Allegro Common Lisp provides no actual compiler, so the Lisp is
interpreted. This is undoubtedly the biggest factor affecting Lisp's apparent speed problem,
relative to C++. I wrote two identical programs in order to perform timed execution tests
for some of the Quoridor code. These identical programs have running times of 27 seconds
(Lisp) and 5 seconds (C++). (The C++ version of this program is available
here.)
In retrospect, I believe that this game takes little
advantage of the symbolic processing aspects of the Lisp language, and uses more of a
number-crunching approach. For most of the program, I could look at Lisp, and translate
directly into C++. For something like "Eliza," this would not be possible. For "Quoridor,"
this was intuitive. Once I had a generic linked list class
available, portation was almost a direct translation. The necessity of this class
introduced the largest single difference between the Lisp and C++ code. After that, the
next biggest level of difference came from the replacement of "cond" statements with
"if-else" constructs.
Now that the coding is complete, I can say with surety that
the largest effects on project feasibility (in this instance) come from the programming
environment, and not from the languages themselves. I am quite confident that this project
is equally feasible in Lisp and in C++, but I enjoyed Borland's environment,
and I experienced many difficulties with Allegro's. Lisp is valuable, and well worth
knowing, however, so I do not regret my experience with it in the least. I just regret
that my experience had to come through Allegro.
Back to Top
<- Back to Quoridor Project Page