| Deutsch English Français Italiano |
|
<86h67chxn8.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c++ Subject: Re: Is this program OOP? Date: Mon, 09 Dec 2024 22:15:07 -0800 Organization: A noiseless patient Spider Lines: 58 Message-ID: <86h67chxn8.fsf@linuxsc.com> References: <63cd41709a703e4ac6d76427d53fe06d7ee8b8b1.camel@gmail.com> <86plm0iwtj.fsf@linuxsc.com> <035b9e2186f9dc6467806e27a76d98525c104e54.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 10 Dec 2024 07:15:10 +0100 (CET) Injection-Info: dont-email.me; posting-host="7c69f8b5423b1596dedc427c8f41595d"; logging-data="900825"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UjiQkQyLqbraYSd4PtfjOV+lQQqFx1Ok=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:JJUOFlTg9ES3oF2eOrl5WJ9QHSc= sha1:x7m7I7ZNYIk6sq86oIsblJULnsw= wij <wyniijj5@gmail.com> writes: > On Mon, 2024-12-09 at 09:35 -0800, Tim Rentsch wrote: > >> wij <wyniijj5@gmail.com> writes: >> >>> Because I said: C++ is the best language to model general >>> problems. So it is. >>> >>> Almost all are logical propositions. Except those few keywords, >>> such programwon't be recognized as a C++ program, instead of some >>> kind of declarative language. >>> >>> Zebra puzzle is an interesting programing exercise because it is >>> not too easy and also not too difficult. >>> >>> ------------ >>> /* Copyright is licensed by GNU LGPL, see file COPYING. by I.J.Wang 2023 >>> >>> Example of solving the zebra puzzle by using propositional logic. >>> Zebra Puzzle https://en.wikipedia.org/wiki/Zebra_Puzzle >>> >>> [...] >>> */ >>> #include <Wy.stdio.h> >>> #include <Sc/PropExpr.h> >>> >>> using namespace Wy; >>> using namespace Sc; >>> >>> [...] >> >> You're asking a question that cannot be answered because much or >> most of the program is in the two include files, which are not >> shown. >> >> As a general rule, when posting code there should be enough posted >> so that readers can at least compile it. In cases like the program >> asked about here, what is posted should be enough to both compile >> the program and run the generated executable. > > I thought nobody will be interested with the implement, and what > is shown should be enough for the moment. The point is that what was posted is not enough to answer the question of the Subject: line. > The Zebra Puzzle program has two version, a_puzzle_21.cpp (has > shown) takes too long to complete. a_puzzle_2.cpp (736 lines, too > long to post, I thought) is the realistic one written in way I > feel just solving the prolem is enough. I wrote a program in prolog to solve this puzzle. The entire program is 60 lines long, including 13 blank lines. It finds the solution in 0.03 seconds. The program doesn't do anything fancy; it pretty much just gives the listed conditions in the form of prolog rules, plus 20 lines to establish the structure of the information that is being sought.