Skip to content

SauloCav/A-Logic-Problem-With-Prolog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

A Logic Problem With Prolog

Activity Proposal:

The famous scientists residential project is being built in a large Brazilian city. It is made up of five blocks (named after scientists and arranged side by side) and each one is designed by an architect. In addition, each building has a different leisure area. Discover the characteristics of the five buildings and their respective architects at the Cientistas Famosos residential building.

Data:

• The block with the Party Room is at one end.
• The block that has an Academy is next to the one that has 50% of the units sold.
• The youngest architect and responsible for the block next to the one with the swimming pool.
• The pool block has 70% of the units sold.
• The 56-year-old architect's building is exactly to the left of the 45-year-old architect's building.
• The 50-year-old architect's block is next to the one that has already sold 70%.
• The Watt block is next to the one with a barbecue.
• The best selling building is exactly to the left of the Watt block.
• The 51-year-old architect is working on the block at one end.
• Fabio is responsible for the design of the building with details in White.
• The block with details in Blue is next to the one with the Piscina.
• The Newton block is next to the block designed by Sérgio.
• William is working on the fifth building.
• In the third position is the Tesla block.
• The least sold building is in fifth position.
• The Tesla block is exactly to the left of the Pascal block.
• The Gauss block is somewhere to the right of the building that has red accents.
• The building with the Gym has 80% of its units sold.
• The block with Barbecue is being designed by the 47-year-old architect.
• The building designed by the older architect is somewhere to the right of the building that has blue accents.
• The block that has details in White is exactly to the left of the one designed by Eduardo.
• The buildings with details in Yellow and with a Pool are neighbors.
• The Gauss block is at one end.

The query should return the complete configuration of each block: name, details, architect, age, sold, has.

For each of the items mentioned there are the following 5 options:

Block name = Gauss, Newton, Pascal, Tesla, Watt
Details = Yellow, Blue, White, Green, Red
Architect = Alberto, Eduardo, Fabio, Sérgio, William
Age = 45, 47, 50, 51, 56
Sold = 50%, 60%, 70%, 80%, 90%
Has = Gym, Barbecue, Swimming pool, Ballroom, Games Room

Results:

image


Made in: https://swish.swi-prolog.org/

About

A logic problem solved using the Prolog language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages