\ProvidesPackage{algorithms-hw}[2018/02/16 Homework for CSCI 382 at Hendrix College]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatletter

% Homework number
\DeclareOptionX{num}[]{\def\alg@hwnum{#1}}

% Due time
\DeclareOptionX{time}[]{\def\alg@time{#1}}
\def\alg@time{5:00pm}  % Default due time

% Due dow (default Friday)
\DeclareOptionX{dow}[]{\def\alg@dow{#1}}
\def\alg@dow{Friday}

% Due date
\DeclareOptionX{date}[]{\def\alg@date{#1}}

% HW topic
\DeclareOptionX{topic}[]{\def\alg@topic{#1}}

% Are these solutions?
\newif\if@algsolutions\@algsolutionsfalse
\DeclareOptionX{solutions}{\@algsolutionstrue}

% Is this an exam?
\newif\if@algexam\@algexamfalse
\DeclareOptionX{exam}{\@algexamtrue}

\ProcessOptionsX\relax

\RequirePackage{times,graphicx,epstopdf,fancyhdr,amsfonts,amsthm,amsmath,url,xspace,algorithm,algorithmicx,enumitem,qrcode}
\RequirePackage[noend]{algpseudocode}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Headers/footers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pagestyle{fancy}

\lhead{CSCI 382: Algorithms -- Fall 2022}
\chead{}
\rhead{Brent Yorgey}
\lfoot{\if@algexam{Exam}\else{Homework}\fi\ \alg@hwnum\if@algexam{}\else\ (\alg@topic)\fi\if@algsolutions{ \textbf{Solutions}}\fi}
\rfoot{Due: \alg@time, \alg@dow, \alg@date}
\cfoot{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\headwidth}{\textwidth}
\renewcommand{\footrulewidth}{0.4pt}

\newtheorem{claim}{Claim}
\newtheorem{definition}{Definition}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{observation}{Observation}

\if@algsolutions
\theoremstyle{theorem}
\else
\theoremstyle{definition}
\fi
\newtheorem{question}{Question}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Semantic markup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\term}[1]{\emph{#1}}
\newcommand{\ie}{\emph{i.e.}\xspace}
\newcommand{\eg}{\emph{e.g.}\xspace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Structured proofs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newenvironment{sproof}{%
    \begin{tabbing}
    \phantom{$\equiv$} \= \qquad\qquad\qquad\qquad\qquad \= \kill
}{
    \end{tabbing}
}
\newcommand{\stmt}[1]{\> \ensuremath{#1} \\}
\newcommand{\lstmt}[1]{\> \ensuremath{#1} }
\newcommand{\reason}[2]{\ensuremath{#1} \>\> \{ \quad #2 \quad \} \\}

\newcommand{\subpart}[1]{\llcorner #1 \lrcorner}
\newcommand{\suppart}[1]{\ulcorner #1 \urcorner}

\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Code listings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{11} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{11}  % for normal
\DeclareFixedFont{\tti}{T1}{txtt}{m}{it}{11}

% Custom colors
\usepackage{color}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}

% Remove listing and listing* commands, see https://tex.stackexchange.com/questions/558883/how-can-i-make-minted-in-newfloat-mode-work-with-dot2texi

\usepackage{etoolbox}

\csundef{listing}\csundef{endlisting}
\csundef{listing*}\csundef{endlisting*}

\usepackage[newfloat]{minted}
% \usepackage{listings}

% Python style for highlighting
% \newcommand\pythonstyle{\lstset{
% language=Python,
% basicstyle=\small\ttm,
% commentstyle=\small\tti,
% otherkeywords={self},             % Add keywords here
% keywordstyle=\small\ttb\color{deepblue},
% emph={MyClass,__init__},          % Custom highlighting
% emphstyle=\small\ttb\color{deepred},    % Custom highlighting style
% stringstyle=\color{deepgreen},
% frame=tb,                         % Any extra options here
% showstringspaces=false            %
% }}


% % Python environment
% \lstnewenvironment{python}[1][]
% {
% \pythonstyle
% \lstset{#1}
% }
% {}

% % Python for external files
% \newcommand\pythonexternal[2][]{{
% \pythonstyle
% \lstinputlisting[#1]{#2}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Aligned code environment
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{polytable}

% Taken from https://tex.stackexchange.com/questions/255280/reproduce-lhs2tex-s-code-indentation-in-latex/255303
\begingroup
\catcode`!=\active
\gdef\activateexclamationmark{%    note the global \gdef
  \catcode`!=\active%
  \def!##1 {\kw{##1} }%
}
\endgroup

\def\acode{%
\begingroup%
\activateexclamationmark%
\sffamily%
\ptboxed%
\defaultcolumn{@{}l@{ }}%
\ignorespaces%
}
\def\endacode{%
\endptboxed%
\endgroup%
}

\newcommand{\tb}{\mbox{\quad}}
\newcommand{\kw}[1]{\textbf{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Cover sheet
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% TODO: allow for different questions on cover sheet from week to week??

\newcommand{\coversheet}{
  \mbox{}
\vspace{\fill}

\textbf{The first page of your homework submission must be a cover
  sheet answering the following questions.}  Do not leave it until the
last minute; it's fine to fill out the cover sheet before you have
completely finished the assignment. Assignments submitted without a
cover sheet, or with a cover sheet obviously dashed off without much
thought at the last minute, will not be graded.  \vspace{1in}

\begin{itemize}
\item How many hours would you estimate that you spent on this
  assignment?
  \vspace{1in}
\item Explain (in one or two sentences) one thing you learned through
  doing this assignment.
  \vspace{1in}
\item What is one thing you think you need to review or study more?
  What do you plan to do about it?
\end{itemize}

\vspace{\fill}

\newpage
}

\endinput