% Instructions:
%   - Please submit ONLY this file up to GradeScope!
%   - Implement as many of the predicates as you can as specified in the assignment!
%   - Have lots of fun! Wahoo!
%   - Do not change the module information of this file or the name of this file (i.e., do not change line 6)!
:- module( ex3, [ myappend/3 , myreverse/2 , myflatten/2 , mymember/2 , myremove/3 , mymember2/2 , mysubstring/2 , mysublists/2 , mypermutation/2 , grandfather/2 , grandmother/2 , brother/2 , sister/2 , sibling/2 , cousin/2 , contact/3 , josephus/5 ]).


%%%% Question 1.
myappend(_,_,_).
myreverse(_,_).
myflatten(_,_).
mymember(_, _).
myremove(_, _, _).

%%%% Question 2.
mymember2(_, _).

%%%% Question 3.
mysubstring(_, _).

%%%% Question 4
mysublists(_,_).

%%%% Question 5
mypermutation(_,_).
    
%%%% Question 6

% Understand these predicates as follows.
%   son(Mom, Dad, Child)      is read as ``Child is the son of the mother Mom and the father Dad''
%   daughter(Mom, Dad, Child) is read as ``Child is the daughter of the mother Mom and the father Dad''

son(mymom, mydad, theson).
daughter(mymom, mydad, thedaughter).
% Add your own family members too!

% Understand these predicates as follows.
%   grandfather(A,B). is read as ``A is a grandfather of B''
%   grandmother(A,B). is read as ``A is a grandmother of B''
%   brother(A,B).     is read as ``A is a brother of B''
%   sister(A,B).      is read as ``A is a sister of B''
%   sibling(A,B).     is read as ``A is a sibling of B''
%   cousin(A,B).      is read as ``A is a cousin of B''

grandfather(_,_).
grandmother(_,_).
brother(_,_).
sister(_,_).
sibling(_,_).
cousin(_,_).

%%%% Question 7
contact(_,_,_).

%%%% Question 8
% Please see the assignment for the logic puzzle. 
% This question will just be hand graded!

%%%% Question 9
% The parameters are as follows...
%   - NumberOfSoldiers: the total number of soldiers including Josephus and his accomplice (> 2)
%   - StartingPosition: the starting position
%   - N: The selected number to count down
%   - J: Output position for Josephus (< NumberOfSoldiers)
%   - A: Output position for the accomplice (< NumberOfSoldiers)
% where all positions are 0 indexed
josephus(NumberOfSoldiers, StartingPosition, N, J, A).
