Prolog I.
![USA](http://www.erepublik.net/images/flags_png/S/United-Kingdom.png)
Alphabethis
As I announced, I'm starting a new phase about studying and building a game around the game. For that purpose, I am using a programming language called prolog:
Go to:
http://www.compileonline.com/execute_prolog_online.php
and paste :
isatool('hammer', 20, 3).
isatool('screw', 1, 2).
effort(Force, X, []):- Force =
effort(Force, Cost, [X| Restlistitems]):- isatool(X, Forcetool, Costtool ),
Remainingforce is Force - Forcetool,
effort(Remainingforce, Remainingcost, Restlistitems ), Cost is Remainingcost + Costtool.
withleastcost(Force, Cost, X ):- effort(Force,Cost, 😵
, \+ cheaper(Force, Cost, _),!.
cheaper(Force, Cost, 😵
:- effort(Force, Cost2, 😵
, Cost > Cost2.
in the left windown "main.pr"
and paste:
withleastcost(23, X,Y).
in the textbox who reads "STDIN Input: "
Press the "execute " button and you'll get in the right:
X = 6
Y = [hammer,hammer]
yes
Exactly, prolog can compute best solutions for complex problems. Needless to say that this is one of the simplest examples.
My aim is to model economic erep and perhaps military to get interesting data... or a game in the long run.
Let's see. I'll post results here , not the models itself to prevent plato clamining ownership. Anyway, some results will be interesting. I think.
Comments
First article I ever read that gave me homework... 🙁
.
homework? cancer. the word you are looking for is cancer
[removed]