Re: Is this program OOP?

Liste des GroupesRevenir à cl c++ 
Sujet : Re: Is this program OOP?
De : ross.a.finlayson (at) *nospam* gmail.com (Ross Finlayson)
Groupes : comp.lang.c++
Date : 10. Dec 2024, 02:26:05
Autres entêtes
Message-ID : <wYSdnT38YoYwBcr6nZ2dnZfqnPadnZ2d@giganews.com>
References : 1 2 3
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
On 12/09/2024 02:35 PM, wij wrote:
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 include files refer to two separate
libraries. I had just updated libsc to save 'unupdate' explanations.
https://sourceforge.net/projects/cscall/
https://sourceforge.net/projects/symbcomp/
>
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.
>
-------------------
[]$ make a_puzzle_p2
[]$ ./a_puzzle_p2
....
(3,Red,Englishman,Milk,OldGold,Snails)
(0,Green,Japanese,Coffee,Parliament,Zebra)
(1,Yellow,Norwegian,-,Kools,Fox)
(0,Ivory,Spaniard,OrangeJuice,LuckyStrike,Dog)
(2,Blue,Ukrainian,Tea,Chesterfield,Horse)
....
>
Repeatedly dumping the same thing says there is only one answer.
Ans: Japanese owns the Zebra.
      Norwegian drinks water (only one possibility left)
---------------------
>
My whole point is that C++(and other programing languages, but less optimal,IMO)
could be a languge of mathmatics/logic, nearly the base of formal knowledges (so
don't make it too arbitrarily like a commercial product. Anyway, C++ is created
'for fun', a mathmatician's fun).
In short and roughly, inference is a kind of manipulation of model (I did not
predict what anyone's brain can do, human brain can create model)
We already use simulators to predict things, simulation is a kind of inference
based on all the 'pure' theories we presumed must be correct or 'tautologic' (
olcott's word).
[Snippet from README_en]
    3. Theory is 'fabricated' after-events, starting entirely from current
       theory totally misplaces the goal and the problem.
    ...
>
>
(I think usually one might call that "compiled FSM",
as with regards to "jump tables" for example, what
accumulate property bits, or enums or flags. It's
nice to think that PropExpr results a little compile-time
solver. In C++ it might be a fun exercise in templates.)

Date Sujet#  Auteur
9 Dec 24 * Is this program OOP?23wij
9 Dec 24 `* Re: Is this program OOP?22Tim Rentsch
9 Dec 24  `* Re: Is this program OOP?21wij
10 Dec 24   +- Re: Is this program OOP?1Ross Finlayson
10 Dec 24   `* Re: Is this program OOP?19Tim Rentsch
10 Dec 24    `* Re: Is this program OOP?18wij
10 Dec 24     `* Re: Is this program OOP?17David Brown
10 Dec 24      +* Re: Is this program OOP?9Muttley
11 Dec 24      i`* Re: Is this program OOP?8David Brown
11 Dec 24      i `* Re: Is this program OOP?7Muttley
11 Dec 24      i  +* Re: Is this program OOP?4Ross Finlayson
12 Dec 24      i  i`* Re: Is this program OOP?3Muttley
12 Dec 24      i  i `* Re: Is this program OOP?2Ross Finlayson
13 Dec 24      i  i  `- Re: Is this program OOP?1Ross Finlayson
12 Dec 24      i  `* Re: Is this program OOP?2Paavo Helde
12 Dec 24      i   `- Re: Is this program OOP?1Muttley
10 Dec 24      `* Re: Is this program OOP?7wij
11 Dec 24       +* Re: Is this program OOP?5David Brown
12 Dec 24       i`* Re: Is this program OOP?4wij
12 Dec 24       i `* Re: Is this program OOP?3David Brown
14 Dec 24       i  `* Re: Is this program OOP?2wij
15 Dec 24       i   `- Re: Is this program OOP?1David Brown
12 Dec 24       `- Re: Is this program OOP?1Tim Rentsch

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal