Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8886879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:39:57+00:00 2026-06-14T21:39:57+00:00

I’m new user and i need you help with a prolog program. The sailing

  • 0

I’m new user and i need you help with a prolog program.

The sailing club “Thalassa” recently held a contest for young sailors, with boats of two people. The crew of each vessel was a boy and a girl.

  1. One member of the crew of the vessel “Ostria” was “Argiris”.
  2. Magda was neither with “Miltos” nor with “Taki”. “Xronis” and “Maro” was not in the “Albatross” and not finished in 24 minutes.
  3. “Olga” aboard the “Batis”, while the “Aetos” did not finish in 27 minutes.
  4. In “Thiella” was or “Miltos” or “Takis” and not aboard the “Basia”.
  5. “Xara” finished in 16 minutes. “Olga” took more time than “Magda” to finish.
  6. “Takis” with her ​​partner finished the race in 21 minutes.

Vessel: “Aetos, “Ostria”, “Batis”, “Albantros”, “Thiella”
Men: “Miltos”, “Takis”, “Argiris”, “Xronis”, “Foibos”
wemen: “Maro”, “Olga”, “Basia”, “Magda”, “Xara”
times: “16”, “19”, “21”, “24”, “27”

i need a program to ask ? solve(X) and gives me a list with the right combination
e.g. X=Aetos, Takis, Maro, 16

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:39:59+00:00Added an answer on June 14, 2026 at 9:39 pm

    edit: I missed the “eclipse” tag, so perhaps this isn’t the answer you’re looking for. It works in plain Prolog though, i.e. SWI.


    So you do have the enumeration of participants, at least we don’t need to deduce that. Start with it:

    • Vessel: “Aetos, “Ostria”, “Batis”, “Albatross”, “Thiella”
    • Men: “Miltos”, “Takis”, “Argiris”, “Xronis”, “Foibos”
    • women: “Maro”, “Olga”, “Basia”, “Magda”, “Xara”
    • times: “16”, “19”, “21”, “24”, “27”

    Rules: Use the times as values!:

    1  Argiris = Ostria,
    2  Magda \= Miltos, Magda \= Takis,     
       Xronis \= Albatross, Maro \= Albatross, Xronis \= 24, Maro \= 24, 
         %% does that mean they were together in one boat??
    3  Olga = Batis, Aetos \= 27,  
    4  ( Thiella = Miltos  ;  Thiella = Takis) ,  Thiella \= Basia,
    5  Xara = 16, Olga > Magda,
    6  Takis = 21
    

    Use select/2 for domain selection:

    select([A|B], C):- select(A,C,C2), select(B,C2).
    select([],_).
    

    We’re ready to start coding. The most definite statements go first. It is important to not test any variable until it is defined:

    sailing(_Vars):-
      Dom = [16,19,21,24,27],     %% the domain
      Takis = 21, 
      select( [Takis, Miltos, Argiris, Xronis, Foibos], Dom), Xronis \= 24, 
      Xara = 16,  
      select( [Xara,  Maro,   Magda,   Olga,   Basia],  Dom), Maro \= 24,
      Magda \= Takis, Magda \= Miltos, Olga > Magda, 
      Olga = Batis, Argiris = Ostria, 
      select( [Batis, Ostria, Aetos, Albatross, Thiella], Dom), Aetos \= 27,
      Thiella \= Basia, 
      (Thiella = Miltos  ;  Thiella = Takis),
      Xronis \= Albatross, Maro \= Albatross.
    

    This gives me 57 solutions. So perhaps Xronis and Maro do need to be put into same boat. Try it.


    How to report your answer is an additional concern. The above shows the solver.

    One way is to tweak the above code as e.g.

    solve([Takis, Miltos, Argiris, Xronis, Foibos]) :- ... .
    

    and call it as ?- solve(Men), to see the time assignments for each of Men. Another is to alter the code as e.g.

    pair( A-B, A, B).
    
    solve(Result) :-
      ... ,
      keysort( [Takis-'Takis', Miltos-'Miltos', Argiris-'Argiris',
                              Xronis-'Xronis', Foibos-'Foibos'], TM),
      maplist( pair,TM,Times,Men),
      keysort( [Xara-'Xara',  Maro-'Maro',   Magda-'Magda',   
                             Olga-'Olga',   Basia-'Basia'], TW),
      maplist( pair,TW,Times,Women),
      ... ,
      maplist( pair,TV,Times,Vessels),
      Result = [Vessels,Men,Women,Times],
      maplist( writeln, Result).
    

    If you further want to convert the four lists in Result into one transposed list of combined data, you can do that too with few more maplist/4 calls, e.g.

    maplist( pair,VM,Vessels,Men), maplist( pair,WT,Women,Times),
    maplist( quad,Result,VM,WT).
    
    quad( (A,B,C,D), A-B, ... ).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.