瀏覽代碼

commit inicial

David 10 年之前
當前提交
f9bef15419
共有 14 個文件被更改,包括 1309 次插入0 次删除
  1. 675 0
      Algo1Macros.tex
  2. 347 0
      caratula.sty
  3. 二進制
      enunciadoTPE_v1.pdf
  4. 48 0
      espec/auxiliares.tex
  5. 15 0
      espec/campo.tex
  6. 42 0
      espec/drone.tex
  7. 67 0
      espec/sistema.tex
  8. 二進制
      logo_dc.jpg
  9. 二進制
      logo_uba.jpg
  10. 60 0
      resolucion.tex
  11. 14 0
      tipos/campo.tex
  12. 15 0
      tipos/drone.tex
  13. 15 0
      tipos/sistema.tex
  14. 11 0
      tipos/tipos.tex

+ 675 - 0
Algo1Macros.tex

@@ -0,0 +1,675 @@
+\usepackage{ifthen}
+\usepackage{amssymb}
+\usepackage{multicol}
+\usepackage{graphicx}
+\usepackage[absolute]{textpos}
+\makeatletter
+
+\@ifclassloaded{beamer}{%
+  \newcommand{\tocarEspacios}{%
+    \addtolength{\leftskip}{4em}%
+    \addtolength{\parindent}{-3em}%
+  }%
+}
+{%
+  \usepackage[top=1cm,bottom=2cm,left=1cm,right=1cm]{geometry}%
+  \usepackage{color}%
+  \newcommand{\tocarEspacios}{%
+    \addtolength{\leftskip}{5em}%
+    \addtolength{\parindent}{-3em}%
+  }%
+}
+
+\newcommand{\encabezadoDeProblema}[4]{%
+  % Ponemos la palabrita problema en tt
+%  \noindent%
+  {\normalfont\bfseries\ttfamily problema}%
+  % Ponemos el nombre del problema
+  \ %
+  {\normalfont\ttfamily #2}%
+  \ 
+  % Ponemos los parametros
+  (#3)%
+  \ifthenelse{\equal{#4}{}}{}{%
+  \ =\ %
+  % Ponemos el nombre del resultado
+  {\normalfont\ttfamily #1}%
+  % Por ultimo, va el tipo del resultado
+  \ : #4}
+}
+
+\newcommand{\encabezadoDeTipo}[2]{%
+  % Ponemos la palabrita tipo en tt
+  {\normalfont\bfseries\ttfamily tipo}%
+  % Ponemos el nombre del tipo
+  \ %
+  {\normalfont\ttfamily #2}%
+  \ifthenelse{\equal{#1}{}}{}{$\langle$#1$\rangle$}
+}
+
+% Primero definiciones de cosas al estilo title, author, date
+
+\def\materia#1{\gdef\@materia{#1}}
+\def\@materia{No especifi\'o la materia}
+\def\lamateria{\@materia}
+
+\def\cuatrimestre#1{\gdef\@cuatrimestre{#1}}
+\def\@cuatrimestre{No especifi\'o el cuatrimestre}
+\def\elcuatrimestre{\@cuatrimestre}
+
+\def\anio#1{\gdef\@anio{#1}}
+\def\@anio{No especifi\'o el anio}
+\def\elanio{\@anio}
+
+\def\fecha#1{\gdef\@fecha{#1}}
+\def\@fecha{\today}
+\def\lafecha{\@fecha}
+
+\def\nombre#1{\gdef\@nombre{#1}}
+\def\@nombre{No especific'o el nombre}
+\def\elnombre{\@nombre}
+
+\def\practicas#1{\gdef\@practica{#1}}
+\def\@practica{No especifi\'o el n\'umero de pr\'actica}
+\def\lapractica{\@practica}
+
+
+% Esta macro convierte el numero de cuatrimestre a palabras
+\newcommand{\cuatrimestreLindo}{
+  \ifthenelse{\equal{\elcuatrimestre}{1}}
+  {Primer cuatrimestre}
+  {\ifthenelse{\equal{\elcuatrimestre}{2}}
+  {Segundo cuatrimestre}
+  {Verano}}
+}
+
+
+\newcommand{\depto}{{UBA -- Facultad de Ciencias Exactas y Naturales --
+      Departamento de Computaci\'on}}
+
+\newcommand{\titulopractica}{
+  \centerline{\depto}
+  \vspace{1ex}
+  \centerline{{\Large\lamateria}}
+  \vspace{0.5ex}
+  \centerline{\cuatrimestreLindo de \elanio}
+  \vspace{2ex}
+  \centerline{{\huge Pr\'actica \lapractica -- \elnombre}}
+  \vspace{5ex}
+  \arreglarincisos
+  \newcounter{ejercicio}
+  \newenvironment{ejercicio}{\stepcounter{ejercicio}\textbf{Ejercicio
+      \theejercicio}%
+    \renewcommand\@currentlabel{\theejercicio}%
+  }{\vspace{0.2cm}}
+}  
+
+
+\newcommand{\titulotp}{
+  \centerline{\depto}
+  \vspace{1ex}
+  \centerline{{\Large\lamateria}}
+  \vspace{0.5ex}
+  \centerline{\cuatrimestreLindo de \elanio}
+  \vspace{0.5ex}
+  \centerline{\lafecha}
+  \vspace{2ex}
+  \centerline{{\huge\elnombre}}
+  \vspace{5ex}
+}
+
+
+%practicas
+\newcommand{\practica}[2]{%
+    \title{Pr\'actica #1 \\ #2}
+    \author{Algoritmos y Estructuras de Datos I}
+    \date{Segundo Cuatrimestre 2015}
+
+    \maketitlepractica{#1}{#2}
+}
+
+\newcommand \maketitlepractica[2] {%
+\begin{center}
+\begin{tabular}{r cr}
+ \begin{tabular}{c}
+{\large\bf\textsf{\ Algoritmos y Estructuras de Datos I\ }}\\ 
+Segundo Cuatrimestre 2015\\
+\title{\normalsize Gu\'ia Pr\'actica #1 \\ \textbf{#2}}\\
+\@title
+\end{tabular} &
+\begin{tabular}{@{} p{1.6cm} @{}}
+\includegraphics[width=1.6cm]{logodpt.jpg}
+\end{tabular} &
+\begin{tabular}{l @{}}
+ \emph{Departamento de Computaci\'on} \\
+ \emph{Facultad de Ciencias Exactas y Naturales} \\
+ \emph{Universidad de Buenos Aires} \\
+\end{tabular} 
+\end{tabular}
+\end{center}
+
+\bigskip
+}
+
+
+% Simbolos varios
+
+\newcommand{\ent}{\ensuremath{\mathbb{Z}}}
+\newcommand{\float}{\ensuremath{\mathbb{R}}}
+\newcommand{\bool}{\ensuremath{\mathsf{Bool}}}
+\newcommand{\True}{\ensuremath{\mathrm{True}}}
+\newcommand{\False}{\ensuremath{\mathrm{False}}}
+\newcommand{\Then}{\ensuremath{\rightarrow}}
+\newcommand{\Iff}{\ensuremath{\leftrightarrow}}
+\newcommand{\implica}{\ensuremath{\longrightarrow}}
+\newcommand{\IfThenElse}[3]{\ensuremath{\mathsf{if}\ #1\ \mathsf{then}\ #2\ \mathsf{else}\ #3}}
+
+
+\newcommand{\rango}[2]{[#1\twodots#2]}
+\newcommand{\comp}[2]{[\,#1\,|\,#2\,]}
+
+\newcommand{\rangoac}[2]{(#1\twodots#2]}
+\newcommand{\rangoca}[2]{[#1\twodots#2)}
+\newcommand{\rangoaa}[2]{(#1\twodots#2)}
+
+%ejercicios
+\newtheorem{exercise}{Ejercicio}
+\newenvironment{ejercicio}{\begin{exercise}\rm}{\end{exercise} \vspace{0.2cm}}
+\newenvironment{items}{\begin{enumerate}[i)]}{\end{enumerate}}
+\newenvironment{subitems}{\begin{enumerate}[a)]}{\end{enumerate}}
+\newcommand{\sugerencia}[1]{\noindent \textbf{Sugerencia:} #1}
+
+%tipos basicos
+\newcommand{\rea}{\ensuremath{\mathsf{Float}}}
+\newcommand{\cha}{\ensuremath{\mathsf{Char}}}
+
+\newcommand{\mcd}{\mathrm{mcd}}
+\newcommand{\prm}[1]{\ensuremath{\mathsf{prm}(#1)}}
+\newcommand{\sgd}[1]{\ensuremath{\mathsf{sgd}(#1)}}
+
+%listas
+\newcommand{\TLista}[1]{[#1]}
+\newcommand{\lvacia}{\ensuremath{[\ ]}}
+\newcommand{\lv}{\ensuremath{[\ ]}}
+\newcommand{\longitud}[1]{\left| #1 \right|}
+\newcommand{\cons}[1]{\ensuremath{\mathsf{cons}}(#1)}
+\newcommand{\indice}[1]{\ensuremath{\mathsf{indice}}(#1)}
+\newcommand{\conc}[1]{\ensuremath{\mathsf{conc}}(#1)}
+\newcommand{\cab}[1]{\ensuremath{\mathsf{cab}}(#1)}
+\newcommand{\cola}[1]{\ensuremath{\mathsf{cola}}(#1)}
+\newcommand{\sub}[1]{\ensuremath{\mathsf{sub}}(#1)}
+\newcommand{\en}[1]{\ensuremath{\mathsf{en}}(#1)}
+\newcommand{\cuenta}[2]{\mathsf{cuenta}\ensuremath{(#1, #2)}}
+\newcommand{\suma}[1]{\mathsf{suma}(#1)}
+\newcommand{\twodots}{\ensuremath{\mathrm{..}}}
+\newcommand{\masmas}{\ensuremath{++}}
+
+% Acumulador
+\newcommand{\acum}[1]{\ensuremath{\mathsf{acum}}(#1)}
+\newcommand{\acumselec}[3]{\ensuremath{\mathrm{acum}(#1 |  #2, #3)}}
+
+% \selector{variable}{dominio}
+\newcommand{\selector}[2]{#1~\ensuremath{\leftarrow}~#2}
+\newcommand{\selec}{\ensuremath{\leftarrow}}
+
+
+\newenvironment{problema}[4][res]{%
+  % El parametro 1 (opcional) es el nombre del resultado
+  % El parametro 2 es el nombre del problema
+  % El parametro 3 son los parametros
+  % El parametro 4 es el tipo del resultado
+  % Preambulo del ambiente problema
+  % Tenemos que definir los comandos requiere, asegura, modifica y aux
+  \newcommand{\requiere}[2][]{%
+    {\normalfont\bfseries\ttfamily requiere}%
+    \ifthenelse{\equal{##1}{}}{}{\ {\normalfont\ttfamily ##1} :}\ %
+    \ensuremath{##2}%
+    {\normalfont\bfseries\,;\par}%
+  }
+  \newcommand{\asegura}[2][]{%
+    {\normalfont\bfseries\ttfamily asegura}%
+    \ifthenelse{\equal{##1}{}}{}{\ {\normalfont\ttfamily ##1} :}\
+    \ensuremath{##2}%
+    {\normalfont\bfseries\,;\par}%
+  }
+  \newcommand{\modifica}[1]{%
+    {\normalfont\bfseries\ttfamily modifica\ }%
+    \ensuremath{##1}%
+    {\normalfont\bfseries\,;\par}%
+  }
+  \renewcommand{\aux}[4]{%
+    {\normalfont\bfseries\ttfamily aux\ }%
+    {\normalfont\ttfamily ##1}%
+    \ifthenelse{\equal{##2}{}}{}{\ (##2)}\ : ##3\, = \ensuremath{##4}%
+    {\normalfont\bfseries\,;\par}%
+  }
+  \newcommand{\res}{#1}
+  \vspace{1ex}
+  \noindent
+  \encabezadoDeProblema{#1}{#2}{#3}{#4}
+  % Abrimos la llave
+  \{\par%
+  \tocarEspacios
+}
+% Ahora viene el cierre del ambiente problema
+{
+  % Cerramos la llave
+  \noindent\}
+  \vspace{1ex}
+}
+
+
+  \newcommand{\aux}[4]{%
+    {\normalfont\bfseries\ttfamily aux\ }%
+    {\normalfont\ttfamily #1}%
+    \ifthenelse{\equal{#2}{}}{}{\ (#2)}\ : #3\, = \ensuremath{#4}%
+    {\normalfont\bfseries\,;\par}%
+  }
+
+
+\newcommand{\pre}[1]{\textsf{pre}\ensuremath{(#1)}}
+
+\newcommand{\problemanom}[1]{\textsf{#1}}
+\newcommand{\problemail}[3]{\textsf{problema #1}\ensuremath{(#2) = #3}}
+\newcommand{\problemailsinres}[2]{\textsf{problema #1}\ensuremath{(#2)}}
+\newcommand{\requiereil}[2]{\textsf{requiere #1: }\ensuremath{#2}}
+\newcommand{\asegurail}[2]{\textsf{asegura #1: }\ensuremath{#2}}
+\newcommand{\modificail}[1]{\textsf{modifica }\ensuremath{#1}}
+\newcommand{\auxil}[2]{\textsf{aux }\ensuremath{#1 = #2}}
+\newcommand{\auxilc}[4]{\textsf{aux }\ensuremath{#1( #2 ): #3 = #4}}
+\newcommand{\auxnom}[1]{\textsf{aux }\ensuremath{#1}}
+
+\newcommand{\comentario}[1]{{/*\ #1\ */}}
+
+\newcommand{\nom}[1]{\ensuremath{\mathsf{#1}}}
+
+% -----------------
+% Tipos compuestos
+% -----------------
+
+\newcommand{\Pred}[1]{\mathit{#1}}
+\newcommand{\TSet}[1]{\textsf{Conjunto}\ensuremath{\langle #1 \rangle}}
+\newcommand{\TSetFinito}[1]{\textsf{Conjunto}\ensuremath{\langle #1 \rangle}}
+\newcommand{\TRac}{\tiponom{Racional}}
+\newcommand{\TVec}{\tiponom{Vector}}
+\newcommand{\Func}[1]{\mathrm{#1}}
+\newcommand{\cardinal}[1]{\left| #1 \right|}
+
+
+\newcommand{\sinonimo}[2]{%
+  \noindent%
+  {\normalfont\bfseries\ttfamily tipo\ }%
+  #1\ =\ #2%
+  {\normalfont\bfseries\,;\par}
+}
+
+\newcommand{\enum}[2]{%
+  \noindent%
+  {\normalfont\bfseries\ttfamily tipo\ }%
+  #1\ =\ #2%
+  {\normalfont\bfseries\,;\par}
+}
+
+%~ \newenvironment{tipo}[1]{%
+    %~ \vspace{0.2cm}
+    %~ \textsf{tipo #1}\ensuremath{\{}\\
+    %~ \begin{tabular}[l]{p{0.02\textwidth} p{0.02\textwidth} p{0.82 \textwidth}}
+%~ }{%
+    %~ \end{tabular}
+%~ 
+    %~ \ensuremath{\}}
+    %~ \vspace{0.15cm}
+%~ }
+%~ 
+
+\newenvironment{tipo}[2][]{%
+  % Preambulo del ambiente tipo
+  % Tenemos que definir los comandos observador (con requiere) y aux
+  \newcommand{\observador}[3]{%
+    {\normalfont\bfseries\ttfamily observador\ }%
+    {\normalfont\ttfamily ##1}%
+    \ifthenelse{\equal{##2}{}}{}{\ (##2)}\ : ##3%
+    {\normalfont\bfseries\,;\par}%
+  }
+  \newcommand{\requiere}[2][]{{%
+    \addtolength{\leftskip}{3em}%
+    \setlength{\parindent}{-2em}%
+    {\normalfont\bfseries\ttfamily requiere}%
+    \ifthenelse{\equal{##1}{}}{}{\ {\normalfont\ttfamily ##1} :}\ 
+    \ensuremath{##2}%
+    {\normalfont\bfseries\,;\par}}
+  }
+  \newcommand{\explicacion}[1]{{%
+    \addtolength{\leftskip}{3em}%
+    \setlength{\parindent}{-2em}%
+    \par \hspace{2.3em} ##1 %
+    {\par}
+    }
+  }
+  \newcommand{\invariante}[2][]{%
+    {\normalfont\bfseries\ttfamily invariante}%
+    \ifthenelse{\equal{##1}{}}{}{\ {\normalfont\ttfamily ##1} :}\ 
+    \ensuremath{##2}%
+    {\normalfont\bfseries\,;\par}%
+  }
+  \renewcommand{\aux}[4]{%
+    {\normalfont\bfseries\ttfamily aux\ }%
+    {\normalfont\ttfamily ##1}%
+    \ifthenelse{\equal{##2}{}}{}{\ (##2)}\ : ##3\, = \ensuremath{##4}%
+    {\normalfont\bfseries\,;\par}%
+  }
+  \vspace{1ex}
+  \noindent
+  \encabezadoDeTipo{#1}{#2}
+  % Abrimos la llave
+  \{\par%
+  \tocarEspacios
+}
+% Ahora viene el cierre del ambiente tipo
+{
+  % Cerramos la llave
+  \noindent\}
+  \vspace{1ex}
+}
+
+
+%~ \newcommand{\observador}[3]{%
+    %~ & \multicolumn{2}{p{0.85\textwidth}}{\textsf{observador #1}\ensuremath{(#2):#3}}\\%
+    %~ }
+    
+%~ \newcommand{\observador}[3]{%
+    %~ {\normalfont\bfseries\ttfamily observador\ }%
+    %~ {\normalfont\ttfamily ##1}%
+    %~ \ifthenelse{\equal{##2}{}}{}{\ (##2)}\ : ##3%
+    %~ {\normalfont\bfseries\,;\par}%
+%~ }
+    
+
+%~ \newcommand{\observadorconreq}[3]{
+    %~ & \multicolumn{2}{p{0.85\textwidth}}{\textsf{observador #1}\ensuremath{(#2):#3 \{}}\\
+%~ }
+%~ \newcommand{\observadorconreqfin}{
+    %~ & \multicolumn{2}{p{0.85\textwidth}}{\ensuremath{\}}}\\
+%~ }
+%~ \newcommand{\obsrequiere}[2][]{& & \textsf{requiere #1: }\ensuremath{#2};\\}
+%~ 
+%~ \newcommand{\explicacion}[1]{&& #1 \\}
+%~ \newcommand{\invariante}[2][]{%
+    %~ & \multicolumn{2}{p{0.85\textwidth}}{\textsf{invariante #1: }\ensuremath{#2}}\\%
+%~ }
+%~ \newcommand{\auxinvariante}[2]{
+    %~ & \multicolumn{2}{p{0.85\textwidth}}{\textsf{aux }\ensuremath{#1 = #2}};\\
+%~ }
+%~ \newcommand{\auxiliar}[4]{
+    %~ & \multicolumn{2}{p{0.85\textwidth}}{\textsf{aux }\ensuremath{#1(#2): #3 = #4}};\\
+%~ }
+
+\newcommand{\tiponom}[1]{\ensuremath{\mathsf{#1}}\xspace}
+\newcommand{\obsnom}[1]{\ensuremath{\mathsf{#1}}}
+
+% -----------------
+% Ecuaciones de terminacion en funcional
+% -----------------
+
+\newenvironment{ecuaciones}{%
+    $$
+    \begin{array}{l @{\ /\ (} l @{,\ } l @{)\ =\ } l}
+}{%
+    \end{array}
+    $$
+}
+
+
+
+
+\newcommand{\ecuacion}[4]{#1 & #2 & #3 & #4\\}
+
+\newcommand{\concat}{\nom{concat}}
+
+% Listas por comprension. El primer parametro es la expresion y el
+% segundo tiene los selectores y las condiciones.
+%*\newcommand{\comp}[2]{[\,#1\,|\,#2\,]}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+% En las practicas/parciales usamos numeros arabigos para los ejercicios.
+% Aca cambiamos los enumerate comunes para que usen letras y numeros
+% romanos
+\newcommand{\arreglarincisos}{%
+  \renewcommand{\theenumi}{\alph{enumi}}
+  \renewcommand{\theenumii}{\roman{enumii}}
+  \renewcommand{\labelenumi}{\theenumi)}
+  \renewcommand{\labelenumii}{\theenumii)}
+}
+
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PARCIAL %%%%%%%%%%%%%%%%%%%%%%%%
+\let\@xa\expandafter
+\newcommand{\tituloparcial}{\centerline{\depto -- \lamateria}
+  \centerline{\elnombre -- \lafecha}%
+  \setlength{\TPHorizModule}{10mm} % Fija las unidades de textpos
+  \setlength{\TPVertModule}{\TPHorizModule} % Fija las unidades de
+                                % textpos
+  \arreglarincisos
+  \newcounter{total}% Este contador va a guardar cuantos incisos hay
+                    % en el parcial. Si un ejercicio no tiene incisos,
+                    % cuenta como un inciso.
+  \newcounter{contgrilla} % Para hacer ciclos
+  \newcounter{columnainicial} % Se van a usar para los cline cuando un
+  \newcounter{columnafinal}   % ejercicio tenga incisos.
+  \newcommand{\primerafila}{}
+  \newcommand{\segundafila}{}
+  \newcommand{\rayitas}{} % Esto va a guardar los \cline de los
+                          % ejercicios con incisos, asi queda mas bonito
+  \newcommand{\anchodegrilla}{20} % Es para textpos
+  \newcommand{\izquierda}{7} % Estos dos le dicen a textpos donde colocar
+  \newcommand{\abajo}{2}     % la grilla
+  \newcommand{\anchodecasilla}{0.4cm}
+  \setcounter{columnainicial}{1}
+  \setcounter{total}{0}
+  \newcounter{ejercicio}
+  \setcounter{ejercicio}{0}
+  \renewenvironment{ejercicio}[1]
+  {%
+    \stepcounter{ejercicio}\textbf{\noindent Ejercicio \theejercicio. [##1
+      puntos]}% Formato
+    \renewcommand\@currentlabel{\theejercicio}% Esto es para las
+                                % referencias
+    \newcommand{\invariante}[2]{%
+      {\normalfont\bfseries\ttfamily invariante}%
+      \ ####1\hspace{1em}####2%
+    }%
+    \renewcommand{\problema}[5][result]{
+      \encabezadoDeProblema{####1}{####2}{####3}{####4}\hspace{1em}####5}%
+  }% Aca se termina el principio del ejercicio
+  {% Ahora viene el final
+    % Esto suma la cantidad de incisos o 1 si no hubo ninguno
+    \ifthenelse{\equal{\value{enumi}}{0}}
+    {\addtocounter{total}{1}}
+    {\addtocounter{total}{\value{enumi}}}
+    \ifthenelse{\equal{\value{ejercicio}}{1}}{}
+    {
+      \g@addto@macro\primerafila{&} % Si no estoy en el primer ej.
+      \g@addto@macro\segundafila{&}
+    }
+    \ifthenelse{\equal{\value{enumi}}{0}}
+    {% No tiene incisos
+      \g@addto@macro\primerafila{\multicolumn{1}{|c|}}
+      \bgroup% avoid overwriting somebody else's value of \tmp@a
+      \protected@edef\tmp@a{\theejercicio}% expand as far as we can
+      \@xa\g@addto@macro\@xa\primerafila\@xa{\tmp@a}%
+      \egroup% restore old value of \tmp@a, effect of \g@addto.. is
+      
+      \stepcounter{columnainicial}
+    }
+    {% Tiene incisos
+      % Primero ponemos el encabezado
+      \g@addto@macro\primerafila{\multicolumn}% Ahora el numero de items
+      \bgroup% avoid overwriting somebody else's value of \tmp@a
+      \protected@edef\tmp@a{\arabic{enumi}}% expand as far as we can
+      \@xa\g@addto@macro\@xa\primerafila\@xa{\tmp@a}%
+      \egroup% restore old value of \tmp@a, effect of \g@addto.. is
+      % global 
+      % Ahora el formato
+      \g@addto@macro\primerafila{{|c|}}%
+      % Ahora el numero de ejercicio
+      \bgroup% avoid overwriting somebody else's value of \tmp@a
+      \protected@edef\tmp@a{\theejercicio}% expand as far as we can
+      \@xa\g@addto@macro\@xa\primerafila\@xa{\tmp@a}%
+      \egroup% restore old value of \tmp@a, effect of \g@addto.. is
+      % global 
+      % Ahora armamos la segunda fila
+      \g@addto@macro\segundafila{\multicolumn{1}{|c|}{a}}%
+      \setcounter{contgrilla}{1}
+      \whiledo{\value{contgrilla}<\value{enumi}}
+      {%
+        \stepcounter{contgrilla}
+        \g@addto@macro\segundafila{&\multicolumn{1}{|c|}}
+        \bgroup% avoid overwriting somebody else's value of \tmp@a
+        \protected@edef\tmp@a{\alph{contgrilla}}% expand as far as we can
+        \@xa\g@addto@macro\@xa\segundafila\@xa{\tmp@a}%
+        \egroup% restore old value of \tmp@a, effect of \g@addto.. is
+        % global 
+      }
+      % Ahora armo las rayitas
+      \setcounter{columnafinal}{\value{columnainicial}}
+      \addtocounter{columnafinal}{-1}
+      \addtocounter{columnafinal}{\value{enumi}}
+      \bgroup% avoid overwriting somebody else's value of \tmp@a
+      \protected@edef\tmp@a{\noexpand\cline{%
+          \thecolumnainicial-\thecolumnafinal}}%
+      \@xa\g@addto@macro\@xa\rayitas\@xa{\tmp@a}%
+      \egroup% restore old value of \tmp@a, effect of \g@addto.. is
+      \setcounter{columnainicial}{\value{columnafinal}}
+      \stepcounter{columnainicial}
+    }
+    \setcounter{enumi}{0}%
+    \vspace{0.2cm}%
+  }%
+  \newcommand{\tercerafila}{}
+  \newcommand{\armartercerafila}{
+    \setcounter{contgrilla}{1}
+    \whiledo{\value{contgrilla}<\value{total}}
+    {\stepcounter{contgrilla}\g@addto@macro\tercerafila{&}}
+  }
+  \newcommand{\grilla}{%
+    \g@addto@macro\primerafila{&\textbf{TOTAL}}
+    \g@addto@macro\segundafila{&}
+    \g@addto@macro\tercerafila{&}
+    \armartercerafila
+    \ifthenelse{\equal{\value{total}}{\value{ejercicio}}}
+    {% No hubo incisos
+      \begin{textblock}{\anchodegrilla}(\izquierda,\abajo)
+        \begin{tabular}{|*{\value{total}}{p{\anchodecasilla}|}c|}
+          \hline
+          \primerafila\\
+          \hline
+          \tercerafila\\
+          \tercerafila\\
+          \hline
+        \end{tabular}
+      \end{textblock}
+    }
+    {% Hubo incisos
+      \begin{textblock}{\anchodegrilla}(\izquierda,\abajo)
+        \begin{tabular}{|*{\value{total}}{p{\anchodecasilla}|}c|}
+          \hline
+          \primerafila\\
+          \rayitas
+          \segundafila\\
+          \hline
+          \tercerafila\\
+          \tercerafila\\
+          \hline
+        \end{tabular}
+      \end{textblock}
+    }
+  }%
+  \vspace{0.4cm}
+  \textbf{Nro. de orden:}
+  
+  \textbf{LU:}
+  
+  \textbf{Apellidos:}
+  
+  \textbf{Nombres:}
+  \vspace{0.5cm}
+}
+
+
+
+% AMBIENTE CONSIGNAS
+% Se usa en el TP para ir agregando las cosas que tienen que resolver
+% los alumnos.
+% Dentro del ambiente hay que usar \item para cada consigna
+
+\newcounter{consigna}
+\setcounter{consigna}{0}
+
+\newenvironment{consignas}{%
+  \newcommand{\consigna}{\stepcounter{consigna}\textbf{\theconsigna.}}%
+  \renewcommand{\ejercicio}[1]{\item ##1 }
+  \renewcommand{\problema}[5][result]{\item
+    \encabezadoDeProblema{##1}{##2}{##3}{##4}\hspace{1em}##5}%
+  \newcommand{\invariante}[2]{\item%
+    {\normalfont\bfseries\ttfamily invariante}%
+    \ ##1\hspace{1em}##2%
+  }
+  \renewcommand{\aux}[4]{\item%
+    {\normalfont\bfseries\ttfamily aux\ }%
+    {\normalfont\ttfamily ##1}%
+    \ifthenelse{\equal{##2}{}}{}{\ (##2)}\ : ##3 \hspace{1em}##4%
+  }
+  % Comienza la lista de consignas
+  \begin{list}{\consigna}{%
+      \setlength{\itemsep}{0.5em}%
+      \setlength{\parsep}{0cm}%
+    }
+}%
+{\end{list}}
+
+
+
+% para decidir si usar && o ^
+\newcommand{\y}[0]{\ensuremath{\land}}
+
+% macros de correctitud
+\newcommand{\semanticComment}[2]{#1 \ensuremath{#2};}
+\newcommand{\namedSemanticComment}[3]{#1 #2: \ensuremath{#3};}
+
+
+\newcommand{\local}[1]{\semanticComment{local}{#1}}
+
+\newcommand{\vale}[1]{\semanticComment{vale}{#1}}
+\newcommand{\valeN}[2]{\namedSemanticComment{vale}{#1}{#2}}
+\newcommand{\impl}[1]{\semanticComment{implica}{#1}}
+\newcommand{\implN}[2]{\namedSemanticComment{implica}{#1}{#2}}
+\newcommand{\estado}[1]{\semanticComment{estado}{#1}}
+
+\newcommand{\invarianteCN}[2]{\namedSemanticComment{invariante}{#1}{#2}}
+\newcommand{\invarianteC}[1]{\semanticComment{invariante}{#1}}
+\newcommand{\varianteCN}[2]{\namedSemanticComment{variante}{#1}{#2}}
+\newcommand{\varianteC}[1]{\semanticComment{variante}{#1}}

+ 347 - 0
caratula.sty

@@ -0,0 +1,347 @@
+% **************************************************************************
+%
+%  Package 'caratula', version 0.5 (para componer caratulas de TPs del DC).
+%
+%  En caso de dudas, problemas o sugerencias sobre este package escribir a
+%  Brian J. Cardiff (bcardif arroba gmail.com).
+%  Nico Rosner (nrosner arroba dc.uba.ar).
+%
+% **************************************************************************
+
+% ----- Informacion sobre el package para el sistema -----------------------
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{caratula}[2013/08/04 v0.5 Para componer caratulas de TPs del DC]
+\RequirePackage{ifthen}
+\usepackage{graphicx}
+
+% ----- Imprimir un mensajito al procesar un .tex que use este package -----
+
+\typeout{Cargando package 'caratula' v0.5 (2013/08/04)}
+
+% ----- Algunas variables --------------------------------------------------
+
+\let\Materia\relax
+\let\Submateria\relax
+\let\Titulo\relax
+\let\Subtitulo\relax
+\let\Grupo\relax
+\let\Fecha\relax
+\let\Logoimagefile\relax
+\newcommand{\LabelIntegrantes}{}
+\newboolean{showLU}
+\newboolean{showEntregas}
+\newboolean{showDirectores}
+\newboolean{showCoDirectores}
+
+% ----- Comandos para que el usuario defina las variables ------------------
+
+\def\materia#1{\def\Materia{#1}}
+\def\submateria#1{\def\Submateria{#1}}
+\def\titulo#1{\def\Titulo{#1}}
+\def\subtitulo#1{\def\Subtitulo{#1}}
+\def\grupo#1{\def\Grupo{#1}}
+\def\fecha#1{\def\Fecha{#1}}
+\def\logoimagefile#1{\def\Logoimagefile{#1}}
+
+% ----- Token list para los integrantes ------------------------------------
+
+\newtoks\intlist\intlist={}
+
+\newtoks\intlistSinLU\intlistSinLU={}
+
+\newcounter{integrantesCount}
+\setcounter{integrantesCount}{0}
+\newtoks\intTabNombre\intTabNombre={}
+\newtoks\intTabLU\intTabLU={}
+\newtoks\intTabEmail\intTabEmail={}
+
+\newcounter{directoresCount}
+\setcounter{directoresCount}{0}
+\newtoks\direcTabNombre\direcTabNombre={}
+\newtoks\direcTabEmail\direcTabEmail={}
+
+\newcounter{coDirectoresCount}
+\setcounter{coDirectoresCount}{0}
+\newtoks\codirecTabNombre\codirecTabNombre={}
+\newtoks\codirecTabEmail\codirecTabEmail={}
+
+
+% ----- Comando para que el usuario agregue integrantes --------------------
+
+\def\integrante#1#2#3{%
+    \intlist=\expandafter{\the\intlist\rule{0pt}{1.2em}#1&#2&\tt #3\\[0.2em]}%
+    \intlistSinLU=\expandafter{\the\intlistSinLU\rule{0pt}{1.2em}#1 & \tt #3\\[0.2em]}%
+    %
+    \ifthenelse{\value{integrantesCount} > 0}{%
+        \intTabNombre=\expandafter{\the\intTabNombre & #1}%
+        \intTabLU=\expandafter{\the\intTabLU & #2}%
+        \intTabEmail=\expandafter{\the\intTabEmail & \tt #3}%
+    }{
+        \intTabNombre=\expandafter{\the\intTabNombre #1}%
+        \intTabLU=\expandafter{\the\intTabLU #2}%
+        \intTabEmail=\expandafter{\the\intTabEmail \tt #3}%
+    }%
+    \addtocounter{integrantesCount}{1}%
+}
+
+\def\director#1#2{%
+    \ifthenelse{\value{directoresCount} > 0}{%
+        \direcTabNombre=\expandafter{\the\direcTabNombre & #1}%
+        \direcTabEmail=\expandafter{\the\direcTabEmail & \tt #2}%
+    }{
+        \direcTabNombre=\expandafter{\the\direcTabNombre #1}%
+        \direcTabEmail=\expandafter{\the\direcTabEmail \tt #2}%
+    }%
+    \addtocounter{directoresCount}{1}%
+}
+
+\def\codirector#1#2{%
+    \ifthenelse{\value{coDirectoresCount} > 0}{%
+        \codirecTabNombre=\expandafter{\the\codirecTabNombre & #1}%
+        \codirecTabEmail=\expandafter{\the\codirecTabEmail & \tt #2}%
+    }{
+        \codirecTabNombre=\expandafter{\the\codirecTabNombre #1}%
+        \codirecTabEmail=\expandafter{\the\codirecTabEmail \tt #2}%
+    }%
+    \addtocounter{coDirectoresCount}{1}%
+}
+
+
+% ----- Macro para generar la tabla de integrantes -------------------------
+
+\newcommand{\tablaIntegrantes}{\ }
+
+\newcommand{\tablaIntegrantesVertical}{%
+\ifthenelse{\boolean{showLU}}{%
+    \begin{tabular}[t]{| l @{\hspace{4ex}} c @{\hspace{4ex}} l|}
+        \hline
+        \multicolumn{1}{|c}{\rule{0pt}{1.2em} \LabelIntegrantes} & LU &  \multicolumn{1}{c|}{Correo electr\'onico} \\[0.2em]
+        \hline \hline
+        \the\intlist
+        \hline
+    \end{tabular}
+}{
+    \begin{tabular}[t]{| l @{\hspace{4ex}} @{\hspace{4ex}} l|}
+        \hline
+        \multicolumn{1}{|c}{\rule{0pt}{1.2em} \LabelIntegrantes} &  \multicolumn{1}{c|}{Correo electr\'onico} \\[0.2em]
+        \hline \hline
+        \the\intlistSinLU
+        \hline
+    \end{tabular}
+    }%
+}
+
+\newcommand{\tablaIntegrantesHorizontal}{%
+    \begin{tabular}[t]{ *{\value{integrantesCount}}{c} }
+    \the\intTabNombre \\%
+\ifthenelse{\boolean{showLU}}{
+    \the\intTabLU \\%
+}{}
+    \the\intTabEmail %
+    \end{tabular}%
+}
+
+\newcommand{\tablaDirectores}{%
+\ifthenelse{\boolean{showDirectores}}{%
+	\bigskip
+	Directores
+
+	\smallskip
+    \begin{tabular}[t]{ *{\value{directoresCount}}{c} }
+    \the\direcTabNombre \\%
+    \the\direcTabEmail %
+    \end{tabular}%
+}{}%
+}
+
+\newcommand{\tablaCoDirectores}{%
+\ifthenelse{\boolean{showCoDirectores}}{%
+	\bigskip
+	Co-Directores
+
+	\smallskip
+    \begin{tabular}[t]{ *{\value{coDirectoresCount}}{c} }
+    \the\codirecTabNombre \\%
+    \the\codirecTabEmail %
+    \end{tabular}%
+}{}%
+}
+
+\newcommand{\tablaEntregas}{%
+\ifthenelse{\boolean{showEntregas}}{%
+  \bigskip%
+  \begin{tabular}[t]{|l p{3.5cm} p{1.5cm}|}%
+  \hline%
+  \rule{0pt}{1.2em} Instancia & Docente & Nota \\[0.2em] %
+  \hline%
+  \hline%
+  \rule{0pt}{1.2em} Primera entrega & & \\[0.2em] %
+  \hline%
+  \rule{0pt}{1.2em} Segunda entrega & & \\[0.2em] %
+  \hline%
+  \end{tabular}%
+}{}%
+}
+
+% ----- Codigo para manejo de errores --------------------------------------
+
+\def\se{\let\ifsetuperror\iftrue}
+\def\ifsetuperror{%
+    \let\ifsetuperror\iffalse
+    \ifx\Materia\relax\se\errhelp={Te olvidaste de proveer una \materia{}.}\fi
+    \ifx\Titulo\relax\se\errhelp={Te olvidaste de proveer un \titulo{}.}\fi
+    \edef\mlist{\the\intlist}\ifx\mlist\empty\se%
+    \errhelp={Tenes que proveer al menos un \integrante{nombre}{lu}{email}.}\fi
+    \expandafter\ifsetuperror}
+
+\def\aftermaketitle{%
+  \setcounter{page}{1}
+}
+
+% ----- \maketitletxt correspondiente a la versi�n v0.2.1 (texto v0.2 + fecha ) ---------
+
+\def\maketitletxt{%
+    \ifsetuperror\errmessage{Faltan datos de la caratula! Ingresar 'h' para mas informacion.}\fi
+    \thispagestyle{empty}
+    \begin{center}
+    \vspace*{\stretch{2}}
+    {\LARGE\textbf{\Materia}}\\[1em]
+    \ifx\Submateria\relax\else{\Large \Submateria}\\[0.5em]\fi
+    \ifx\Fecha\relax\else{\Large \Fecha}\\[0.5em]\fi
+    \par\vspace{\stretch{1}}
+    {\large Departamento de Computaci\'on}\\[0.5em]
+    {\large Facultad de Ciencias Exactas y Naturales}\\[0.5em]
+    {\large Universidad de Buenos Aires}
+    \par\vspace{\stretch{3}}
+    {\Large \textbf{\Titulo}}\\[0.8em]
+    {\Large \Subtitulo}
+    \par\vspace{\stretch{3}}
+    \ifx\Grupo\relax\else\textbf{\Grupo}\par\bigskip\fi
+    \tablaIntegrantes
+    \end{center}
+    \vspace*{\stretch{3}}
+    \newpage\aftermaketitle}
+
+% ----- \maketitletxtlogo correspondiente v0.2.1 (texto con fecha y logo) ---------
+
+\def\maketitletxtlogo{%
+    \ifsetuperror\errmessage{Faltan datos de la caratula! Ingresar 'h' para mas informacion.}\fi
+    \thispagestyle{empty}
+    \begin{center}
+    \ifx\Logoimagefile\relax\else\includegraphics{\Logoimagefile}\fi \hfill \includegraphics{logo_dc.jpg}\\[1em]
+    \vspace*{\stretch{2}}
+    {\LARGE\textbf{\Materia}}\\[1em]
+    \ifx\Submateria\relax\else{\Large \Submateria}\\[0.5em]\fi
+    \ifx\Fecha\relax\else{\large \Fecha}\\[0.5em]\fi
+    \par\vspace{\stretch{1}}
+    {\large Departamento de Computaci\'on}\\[0.5em]
+    {\large Facultad de Ciencias Exactas y Naturales}\\[0.5em]
+    {\large Universidad de Buenos Aires}
+    \par\vspace{\stretch{3}}
+    {\Large \textbf{\Titulo}}\\[0.8em]
+    {\Large \Subtitulo}
+    \par\vspace{\stretch{3}}
+    \ifx\Grupo\relax\else\textbf{\Grupo}\par\bigskip\fi
+    \tablaIntegrantes
+    \end{center}
+    \vspace*{\stretch{4}}
+    \newpage\aftermaketitle}
+
+% ----- \maketitlegraf correspondiente a la versi�n v0.3 (gr�fica) -------------
+
+\def\maketitlegraf{%
+    \ifsetuperror\errmessage{Faltan datos de la caratula! Ingresar 'h' para mas informacion.}\fi
+%
+    \thispagestyle{empty}
+
+    \ifx\Logoimagefile\relax\else\includegraphics{\Logoimagefile}\fi \hfill \includegraphics{logo_dc.jpg}
+
+    \vspace*{.06 \textheight}
+
+    \noindent \textbf{\huge \Titulo}  \medskip \\
+    \ifx\Subtitulo\relax\else\noindent\textbf{\large \Subtitulo} \\ \fi%
+    \noindent \rule{\textwidth}{1 pt}
+
+    {\noindent\large\Fecha \hspace*\fill \Materia} \\
+    \ifx\Submateria\relax\else{\noindent \hspace*\fill \Submateria}\fi%
+
+    \medskip%
+    \begin{center}
+        \ifx\Grupo\relax\else\textbf{\Grupo}\par\bigskip\fi
+        \tablaIntegrantes
+
+        \tablaDirectores
+
+        \tablaCoDirectores
+
+        \tablaEntregas
+    \end{center}%
+    \vfill%
+%
+    \begin{minipage}[t]{\textwidth}
+        \begin{minipage}[t]{.55 \textwidth}
+            \includegraphics{logo_uba.jpg}
+        \end{minipage}%%
+        \begin{minipage}[b]{.45 \textwidth}
+            \textbf{\textsf{Facultad de Ciencias Exactas y Naturales}} \\
+            \textsf{Universidad de Buenos Aires} \\
+            {\scriptsize %
+            Ciudad Universitaria - (Pabell\'on I/Planta Baja) \\
+                Intendente G\"uiraldes 2610 - C1428EGA \\
+            Ciudad Aut\'onoma de Buenos Aires - Rep. Argentina \\
+                Tel/Fax: (++54 +11) 4576-3300 \\
+            http://www.exactas.uba.ar \\
+            }
+        \end{minipage}
+    \end{minipage}%
+%
+    \newpage\aftermaketitle}
+
+% ----- Reemplazamos el comando \maketitle de LaTeX con el nuestro ---------
+\renewcommand{\maketitle}{\maketitlegraf}
+
+% ----- Dependiendo de las opciones ---------
+%
+% opciones:
+%   txt     : caratula solo texto.
+%   txtlogo : caratula txt con logo del DC y del grupo (opcional).
+%   graf    : (default) caratula grafica con logo del DC, UBA y del grupo (opcional).
+%
+\@makeother\*% some package redefined it as a letter (as color.sty)
+%
+% Layout general de la caratula
+%
+\DeclareOption{txt}{\renewcommand{\maketitle}{\maketitletxt}}
+\DeclareOption{txtlogo}{\renewcommand{\maketitle}{\maketitletxtlogo}}
+\DeclareOption{graf}{\renewcommand{\maketitle}{\maketitlegraf}}
+%
+% Etiqueta Autores o Integrantes
+%
+\DeclareOption{integrante}{\renewcommand{\LabelIntegrantes}{Integrante}}
+\DeclareOption{autor}{\renewcommand{\LabelIntegrantes}{Autor}}
+%
+% Formato tabla de integrantes
+%
+\DeclareOption{intVert}{\renewcommand{\tablaIntegrantes}{\tablaIntegrantesVertical}}
+\DeclareOption{intHoriz}{\renewcommand{\tablaIntegrantes}{\tablaIntegrantesHorizontal}}
+\DeclareOption{conLU}{\setboolean{showLU}{true}}
+\DeclareOption{sinLU}{\setboolean{showLU}{false}}
+\DeclareOption{conEntregas}{\setboolean{showEntregas}{true}}
+\DeclareOption{sinEntregas}{\setboolean{showEntregas}{false}}
+\DeclareOption{showDirectores}{\setboolean{showDirectores}{true}}
+\DeclareOption{hideDirectores}{\setboolean{showDirectores}{false}}
+\DeclareOption{showCoDirectores}{\setboolean{showCoDirectores}{true}}
+\DeclareOption{hideCoDirectores}{\setboolean{showCoDirectores}{false}}
+%
+% Opciones predeterminadas
+%
+\ExecuteOptions{intVert}%
+\ExecuteOptions{graf}%
+\ExecuteOptions{integrante}%
+\ExecuteOptions{conLU}%
+\ExecuteOptions{hideDirectores}%
+\ExecuteOptions{hideCoDirectores}%
+\ExecuteOptions{sinEntregas}%
+%
+\ProcessOptions\relax

二進制
enunciadoTPE_v1.pdf


+ 48 - 0
espec/auxiliares.tex

@@ -0,0 +1,48 @@
+
+\subsection{Campo}
+% los aux del tipo campo
+$igualdadCampo(c,c':Campo):Bool= dimensiones(c)==dimensiones(c') \wedge (\forall i \leftarrow [0..fst(dimensionesCampo(c)),$\\ $j \leftarrow [0..snd(dimensionesCampo(c)) contenido(c,i,j)==contenido(c',i,j)) $ 
+
+parcelasCampo(c:Campo):$[(\ent , \ent)]$= \newline [(x,y) \textbar x $\leftarrow$ [0..prs(dimensiones(s))),y $\leftarrow$ [0..snd(dimensiones(s)))]
+
+\subsection{Drone}
+
+% los aux del tipo drone
+$igualdadDrone(d,d':Drone):Bool= id(d)==id(d') \wedge bateria(d)==bateria(d') \wedge enVuelo(d)==enVuelo(d') \wedge vueloRealizado(d)==vueloRealizado(d') \wedge mismos(productosDisponibles(d),productosDisponibles(d'))$
+
+mismosDrones(ds,xs:[Drone]):Bool= \textbar ds \textbar == \textbar xs \textbar $ \wedge ( \forall d \leftarrow ds)cantidadAparicionesD(d,ds)==cantidadAperecionesD(d,xs)$
+
+$cantidadAparicionesD(d:Drones,ds:[Drones])=$\textbar $[x $\textbar$ x \leftarrow ds, iguadadDrone(x,d)]$\textbar
+%│[x │ x\leftarrow ds, iguadadDrone(x,d)]│$
+
+escalera1(d:Drone):Bool= ($\forall i \leftarrow$ [0..\textbar vueloRealizado(d)\textbar -1) $prm(vueloRealizado(d)_{i}) \leq prm(vueloRealizado(d)_{i+1}$)\newline if \  $prm(vueloRealizado(d)_{i})== prm(vueloRealizado(d)_{i+1}$\  then  $snd(vueloRealizado(d)_{i})+1== snd(vueloRealizado(d)_{i+1}$\ else $snd(vueloRealizado(d)_{i})== snd(vueloRealizado(d)_{i+1}$
+
+escalera2(d:Drone):Bool= ($\forall i \leftarrow$ [0..\textbar vueloRealizado(d)\textbar -1) $prm(vueloRealizado(d)_{i}) \geq prm(vueloRealizado(d)_{i+1}$)\newline if \  $prm(vueloRealizado(d)_{i})== prm(vueloRealizado(d)_{i+1}$\  then  $snd(vueloRealizado(d)_{i})-1== snd(vueloRealizado(d)_{i+1})$\ else $snd(vueloRealizado(d)_{i})== snd(vueloRealizado(d)_{i+1}$
+
+escalera3(d:Drone):Bool= ($\forall i \leftarrow$ [0..\textbar vueloRealizado(d)\textbar -1) $prm(vueloRealizado(d)_{i}) \leq prm(vueloRealizado(d)_{i+1}$)\newline if \  $prm(vueloRealizado(d)_{i})== prm(vueloRealizado(d)_{i+1}$\  then  $snd(vueloRealizado(d)_{i})-1== snd(vueloRealizado(d)_{i+1})$\ else $snd(vueloRealizado(d)_{i})== snd(vueloRealizado(d)_{i+1}$
+
+escalera4(d:Drone):Bool= ($\forall i \leftarrow$ [0..\textbar vueloRealizado(d)\textbar -1) $prm(vueloRealizado(d)_{i}) \geq prm(vueloRealizado(d)_{i+1}$)\newline if \  $prm(vueloRealizado(d)_{i})== prm(vueloRealizado(d)_{i+1}$\  then  $snd(vueloRealizado(d)_{i})+1== snd(vueloRealizado(d)_{i+1})$\ else $snd(vueloRealizado(d)_{i})== snd(vueloRealizado(d)_{i+1}$
+
+parcelasConChoques(ds:[Drones]):[(($\ent,\ent),\ent$)]= \newline [(p,cantidadDronesenMomento(p,i,ds))\textbar d $\leftarrow$ ds, i $\leftarrow$ [0..\textbar vueloRealizado \textbar), p $\leftarrow$ vueloRealizado(d), \\ cantidadDronesEnMomento(p,i,ds) $\geq$ 2]
+
+cantidadDronesenMomento($p:(\ent, \ent),i:\ent,ds:[Drones]): \ent$ = \\ \textbar [p \textbar d $\leftarrow$ ds, $vueloRecorrido(d)_{i} $== p] \textbar
+
+quitarRepetidos(xs:[($\ent,\ent),\ent$)])=[$x_{i}$ \textbar i $\leftarrow$ [0.. \textbar xs \textbar), ($\forall$ j $\leftarrow$ [0.. \textbar xs \textbar), i $\leq$ j)$x_{i}$ $\lneq$ $x_{j}$]
+
+estaOrdenadoPorLaSugundaCoordenada(xs:[($\ent,\ent),\ent$)]):Bool = ($\forall$ x $\leftarrow$ xs)($\forall$ i,j $\leftarrow$ [0.. \textbar xs \textbar), i$\leq$j)$snd(x_{i})$ $\leq$ $snd(x_{j})$ $\vee$ $snd(x_{i})$ $\geq$ $snd(x_{j})$
+
+\subsection{Sistema}
+
+$parcelasAdyacentes(s:Sistema,i: \ent , j: \ent)): [(\ent , \ent)]$ = [p \textbar p $\leftarrow$ [(i+1,j), (i-1,j), (i,j+1),(i,j-1)], \newline enRango(dimensiones(campo(s)),prs(p),snd(p))]
+
+parcelaAdyacenteConPlaga(s:Sistema, i,j: $\ent$): Bool = $(\forall p \leftarrow parcelasAdyacentes(s,i,j), \newline contenido(campo(s),prs(p),snd(p))==Cultivo)$ estadoDelCultivo(s,prs(p),snd(p))==ConMaleza
+
+algunAdyacenteConPlaga(s:Sistema,i,j:$\ent$):Bool = $(\exists p \leftarrow parcelasAdyacentes(s,i,j),\newline contenido(campo(s),prs(p),snd(p))==Cultivo)$ estadoDelCultivo(s,prs(p),snd(p))==ConMaleza
+
+soloUnDrone(s:Sistema,p:$(\ent , \ent)$):Bool= \textbar [d \textbar d $\leftarrow$ enjambreDrones(s), posicionActual(d) == p ]\textbar == 1 
+
+estaAdyacenteAlGranero(s:Sistema,d:Drone):Bool = \newline ($\exists$ (i,j) $\leftarrow$ parcelasAdyacentes(s,prs(posicionActual(d)),snd(posicionAlcual(s))))
+enRango(dimensiones(campo(s)),i,j) \newline $\wedge$ contenido(campo(s),i,j) $\neq$ Granero
+
+parcelaAdyacenteAlGraneroLibre(s:Sistema):Bool= \newline
+($\exists$ (i,j),(n,m) $\leftarrow$ parcelasCampo(campo(s)))contenido(campo(s),i,j) $\neq$ Granero $\wedge$ contenido(campo(s),n,m)==Granero $\wedge$ (n,m) $\in$ parcelasAdyacentes(i,j)

+ 15 - 0
espec/campo.tex

@@ -0,0 +1,15 @@
+\begin{problema}{crearC}{posG, posC: (\ent, \ent)}{Campo}
+	\requiere{posG \neq posC}
+	\requiere{0 \leq prm(posG) \wedge 0 \leq sgd(posG) \wedge 0 \leq prm(posC) \wedge 0 \leq sgd(posC)}
+	\asegura{contenido(result, prm(posG), sgd(posG))==Granero}
+	\asegura{contenido(result, prm(posC), sgd(posC))==Casa} 
+\end{problema}
+
+\begin{problema}{dimensionesC}{c: Campo}{(Ancho, Largo))}
+	\asegura{res==dimenciones(c)}
+\end{problema}
+
+\begin{problema}{contenidoC}{c: Campo, i, j: \ent}{Parcela}
+	\requiere{0 \leq i \lneq prm(dimenciones(c)) \wedge    0 \leq j \lneq sgd(dimenciones(c))}
+	\asegura {result==contenido(c,i,j)}
+\end{problema}

+ 42 - 0
espec/drone.tex

@@ -0,0 +1,42 @@
+\begin{problema}{crearD}{i: \ent, ps: [Producto]}{Drone}
+	\asegura {id(res)==i} 
+	\asegura {mismos(productosDisponibles(res),pd)}
+	\asegura {bateria(res)==100}
+	\asegura {enVuelo==False}
+%	\asegura {vuelosRealizados(res)==[]}
+\end{problema}
+
+\begin{problema}{idD}{d: Drone}{\ent}
+	\asegura {res==id(d)}
+\end{problema}
+
+\begin{problema}{bateriaD}{d: Drone}{\ent}
+	\asegura {res==bateria(d)}
+\end{problema}
+
+\begin{problema}{enVueloD}{d: Drone}{\bool}
+	\asegura{res==enVuelo(d)} 
+\end{problema}
+	
+\begin{problema}{vueloRealizadoD}{d: Drone}{[(\ent, \ent)]}
+	\asegura{res==vueloRealizado(d)}
+\end{problema}
+
+\begin{problema}{posicionActualD}{d: Drone}{(\ent, \ent)}
+	\asegura{res==posicionAltual(d)}
+\end{problema}
+
+\begin{problema}{productosDisponiblesD}{d: Drone}{[Producto]}
+	\asegura{mismos(res,productosDisponobles(d))}
+\end{problema}
+
+\begin{problema}{vueloEscaleradoD}{d: Drone}{\bool}
+	\asegura{res==\ escalera1(d) \vee escalera2(d)\vee escalera3(d) \vee escalera4(d)}
+\end{problema}
+
+\begin{problema}{vuelosCruzadosD}{ds: [Drone]}{[$((\ent, \ent), \ent)]$}
+	\requiere{(\forall d \leftarrow ds)\mid VueloRealizado(d) \mid == \mid VueloRealizado(d)_{0} \mid}
+	\asegura{\mid res \mid == \mid quitarRepetidos(parcelasConChoques(ds)) \mid}
+	\asegura{estaOrdenadoPorLaSugundaCoordenada(res)}
+	\asegura{(\forall e \leftarrow parcelasConChoques(ds))e \in res } 
+\end{problema}

+ 67 - 0
espec/sistema.tex

@@ -0,0 +1,67 @@
+\begin{problema}{crearS}{c: Campo, ds: [Drone]}{Sistema}
+	\asegura{igualdadCamapo(campo(res),c)}
+	\asegura{(\forall d \leftarrow ds)(\exists d' \leftarrow enjambreDrones(d'))id(d)==id(d') \wedge bateria(d')==100 \wedge \neg enVuelo(d') \wedge \newline enRango(dimesiones(campo(res)), prs(posiconActual(d')),snd(posiconActual(d'))) \wedge \newline contenido(campo(res), prs(posiconActual(d')),snd(posiconActual(d')))==Granero}
+\end{problema}
+
+\begin{problema}{campoS}{s: Sistema}{Campo}
+	\asegura {res==campo(s)}
+\end{problema}
+
+\begin{problema}{estadoDelCultivoS}{s: Sistema, i, j: \ent}{EstadoCultivo}
+	\requiere {enRango(dimensiones(campo(s)),i,j) \wedge contenido(campo(s),i,j)==cultivo}
+	\asegura {res==estadoDelCultivo(s,i,j)}
+\end{problema}
+
+\begin{problema}{enjambreDronesS}{s: Sistema}{[Drone]}
+	\asegura{res==enjambreDrones(s)}
+\end{problema}
+
+\begin{problema}{crecerS}{s: Sistema}{}
+	\modifica s
+	\asegura{igualdadCampo(campo(s),campo(pre(s)))}
+	\asegura{ mismosDrones(enjambreDrones(s),enjambreDrones(pre(s)))}
+	\asegura{(\forall i \leftarrow [0..prs(dimensiones(s)),j \leftarrow [0..snd(dimensiones(s)), enRango(dimensiones(campo(s)),i,j), \newline contenido(campo(s),i,j)==Cultivo, estadoDelCultivo(pre(s),i,j)==RecienSembrado )\newline estadoDelCultivo(s,i,j)==EnCrecimiento }
+	\asegura{(\forall i \leftarrow [0..prs(dimensiones(s)),j \leftarrow [0..snd(dimensiones(s)), enRango(dimensiones(campo(s)),i,j), \newline contenido(campo(s),i,j)==Cultivo, estadoDelCultivo(pre(s),i,j)==EnCrecimiento ) \newline estadoDelCultivo(s,i,j)==ListoParaCosechar} 
+	\asegura {(\forall i \leftarrow [0..prs(dimensiones(s)),j \leftarrow [0..snd(dimensiones(s)), enRango(dimensiones(campo(s)),i,j), \newline contenido(campo(s),i,j)==Cultivo, (estadoDelCultivo(pre(s),i,j)\neq EnCrecimiento \wedge \newline estadoDelCultivo(pre(s),i,j)\neq RecienSembrado  )) \newline estadoDelCultivo(s,i,j)==estadoDelCultivo(pre(s),i,j)}
+\end{problema}
+
+\begin{problema}{seVinoLaMalezaS}{s: Sistema, ps: [(\ent, \ent)]}{}
+	\requiere{(\forall p \leftarrow ps) enRango(dimensiones(campo(pre(s)),prs(p),snd(p))) \wedge \newline contenido(campo(pre(s)),prs(p),sgd(p))==Cultivo}
+	\modifica s
+	\asegura{igualdadCampo(campo(s),campo(pre(s)))}
+	\asegura{ mismosDrones(enjambreDrones(s),emjambreDrones(pre(s)))}
+	\asegura{(\forall i \leftarrow [0..prs(dimensiones(campo(s))), j \leftarrow [0..snd(dimensiones(campo(s))), \newline contenido(campo(s),i,j)==Cultivo \wedge (i,j) \notin ps) estadoDelCultivo(s,i,j)==estadoDelCultivo(pre(s),i,j)}  
+	\asegura{(\forall p \leftarrow ps)estadoDelCultivo(s,prs(p),snd(p))==ConMaleza}
+\end{problema}
+
+\begin{problema}{seExpandePlagaS}{s: Sistema}{}
+	\modifica s
+	\asegura{igualdadCampo(campo(s),campo(pre(s)))}
+	\asegura{mismosDrones(enjambreDrones(s),emjambreDrones(pre(s)))}
+	\asegura{(\forall i \leftarrow [0..prs(dimensiones(campo(pre(s)))), j \leftarrow [0..snd(dimensiones(campo(pre(s))))\newline contenido(campo(pre(s)),i,j) \wedge estadoDelCultivo(pre(s),i,j)==ConPlaga)\newline estadoDelCultivo(s,i,j)==ConPlaga \wedge parcelaAdyacenteConPlaga(s,i,j)}
+	\asegura{(\forall i \leftarrow [0..prs(dimensiones(campo(pre(s)))), j \leftarrow [0..snd(dimensiones(campo(pre(s))))\newline contenido(campo(pre(s)),i,j)==Cultivo \wedge estadoDelCultivo(pre(s),i,j)\neq ConPlaga \wedge \newline  \neg algunAdyacenteConPlaga(s,i,j)) estadoDelCultivo(s,i,j)==estadoDelCultivo(pre(s),i,j)}
+\end{problema}
+
+\begin{problema}{despegarS}{s: Sistema, d: Drone}{}
+	\requiere{bateria(d)==100}
+	\requiere{d \in enjambreDrones(pre(s))}
+	\requiere{hayParcelaAdyacenteAlGraneroLibre(pre(s))}
+	\modifica s
+	\asegura{igualdadCampo(campo(pre(s)),campo(s))}
+	\asegura{(\forall(i,j) \leftarrow parcelasDelSistema(s),contenido(campo(s),i,j)==Cultivo)\newline estadoDelCultivo(pre(s),i,j)==estadoDelCultivo(s,i,j)}
+	\asegura{\mid enjambreDrones(pre(s)) \mid == \mid enjambreDrones(s) \mid}
+	\asegura{(\forall d' \leftarrow enjambreDrones(pre(s)), id(d')==id(d))(\exists d'' \leftarrow enjambreDones(s))igualdadDrones(d',d'')}
+	\asegura{(\exists d' \leftarrow enjambreDrones(s))id(d)==id(d') \wedge enVuelo(d') \wedge bateria(d')==99 \wedge \newline enRango(dimensiones(s),prs(posicionActual(d')),snd(posicionActual(d'))) \wedge \newline soloUnDrone(s,posicionActual(d')) \wedge estaAdyacenteAlGranero(s,(posicionActual(d')) \wedge \newline vueloRealizado(d')==[posicionActual(d')] \wedge  mismos(productosDisponibles(d),productosDisponibles(d'))}
+\end{problema}
+
+\begin{problema}{listoParaCosecharS}{s: Sistema}{\bool}
+\end{problema}
+
+\begin{problema}{aterrizarYCargarBateriaS}{s: Sistema, b: \ent}{}
+\end{problema}
+
+\begin{problema}{fertilizarPorFilas}{s: Sistema}{}
+\end{problema}
+
+\begin{problema}{volarYSensarS}{s: Sistema, d: Drone}{}
+\end{problema}

二進制
logo_dc.jpg


二進制
logo_uba.jpg


+ 60 - 0
resolucion.tex

@@ -0,0 +1,60 @@
+\documentclass[a4paper]{article}
+
+\usepackage[spanish]{babel} % Le indicamos a LaTeX que vamos a escribir en espa�ol.
+\usepackage[latin1]{inputenc} % Permite utilizar tildes y e�es normalmente
+\input{Algo1Macros}% Macros especificas para especificar problemas en AyEDI
+\usepackage{caratula} % Se puede descargar en ~> https://github.com/bcardiff/dc-tex
+
+% Aca solo vamos a poner el esqueleto del documento, pero no vamos a especificar nada.
+
+\begin{document} % Todo lo que escribamos a partir de aca va a aparecer en el documento.
+
+% Completar los datos de la caratula
+\titulo{TPE - Agricultura con drones} 
+\fecha{\today}
+\materia{Algoritmos y Estructuras de Datos I}
+\grupo{Grupo ?}
+
+% Completar con cuantos integrantes quieran :)
+\integrante{Apellido, Nombre1}{001/01}{email1@dominio.com}
+\integrante{Apellido, Nombre2}{002/01}{email2@dominio.com}
+\integrante{Apellido, Nombre3}{003/01}{email3@dominio.com}
+\integrante{Apellido, Nombre4}{004/01}{email4@dominio.com}
+
+\maketitle
+
+\section{Tipos}
+
+\input{tipos/tipos}
+
+\section{Campo}
+
+\input{tipos/campo}
+
+\input{espec/campo}
+
+\newpage
+
+\section{Drone}
+
+\input{tipos/drone}
+
+\input{espec/drone}
+
+\newpage
+
+\section{Sistema}
+
+\input{tipos/sistema}
+
+\input{espec/sistema}
+
+%\input{espec/ejersRecu}
+
+\newpage
+
+\section{Funciones Auxiliares}
+
+\input{espec/auxiliares.tex}
+
+\end{document} %Termin�!

+ 14 - 0
tipos/campo.tex

@@ -0,0 +1,14 @@
+\begin{tipo}{Campo}
+	\observador{dimensiones}{c: Campo}{(Ancho, Largo)}
+	\observador{contenido}{c: Campo, i, j: \ent}{Parcela}
+		\requiere[enRango]{0 \leq i < prm(dimensiones(c)) \land 0 \leq j < sgd(dimensiones(c))}
+	\medskip
+	\invariante[dimensionesValidas]{prm(dimensiones(c)) > 0 \land sgd(dimensiones(c)) > 0}
+	\invariante[unaSolaCasa]{|[(i, j) | i \selec \rangoca{0}{prm(dimensiones(c))},  j \selec \rangoca{0}{sgd(dimensiones(c))}, \\ contenido(c, i, j) == Casa]| == 1}
+	\invariante[unSoloGranero]{|[(i, j) | i \selec \rangoca{0}{prm(dimensiones(c))},  j \selec \rangoca{0}{sgd(dimensiones(c))}, \\ contenido(c, i, j) == Granero]| == 1}
+	\invariante[algoDeCultivo]{|[(i, j) | i \selec \rangoca{0}{prm(dimensiones(c))},  j \selec \rangoca{0}{sgd(dimensiones(c))}, \\ contenido(c, i, j) == Cultivo]| \geq 1}
+	\invariante[posicionesAlcanzables]{posicionesAlcanzablesEn100(c)}
+
+\end{tipo}
+
+\noindent \aux{posicionesAlcanzablesEn100}{c: Campo}{\bool}{\\alcanzableEn100(posicionGranero(c), prm(dimensiones(c)), sgd(dimensiones(c)))}

File diff suppressed because it is too large
+ 15 - 0
tipos/drone.tex


+ 15 - 0
tipos/sistema.tex

@@ -0,0 +1,15 @@
+\begin{tipo}{Sistema}
+	\observador{campo}{s: Sistema}{Campo}
+	\observador{estadoDelCultivo}{s: Sistema, i, j: \ent}{EstadoCultivo}
+		\requiere{enRango(dimensiones(s), i, j) \land contenido(campo(s), i,j) == Cultivo}
+	\observador{enjambreDrones}{s: Sistema}{[Drone]}
+
+	\medskip
+
+	\invariante[identificadoresUnicos]{sinRepetidos(\comp{id(d)}{d \selec enjambreDrones(s)})}
+	\invariante[unoPorParcela]{(\forall d, d' \selec dronesEnVuelo(s), id(d) \neq id(d')) posicionActual(d) \neq posicionActual(d')}
+	\invariante[siNoVuelanEstanEnGranero]{(\forall d \selec enjambreDrones(s), \neg enVuelo(d)) \\ posicionActual(d) == posicionGranero(campo(s))}
+	\invariante[siEstanEnVueloElVueloEstaEnRango]{(\forall d \selec dronesEnVuelo(s)) (\forall v \selec vueloRealizado(d))\\ enRango(dimensiones(campo(s), prm(v), sgd(v))} 
+\end{tipo}
+
+\aux{dronesEnVuelo}{s: Sistema}{[Drone]}{\comp{d}{d \selec enjambreDrones(s), enVuelo(d)}}

+ 11 - 0
tipos/tipos.tex

@@ -0,0 +1,11 @@
+\newcommand{\id}{Id}
+\newcommand{\carga}{Carga}
+\newcommand{\ancho}{Ancho}
+\newcommand{\largo}{Largo}
+\sinonimo{\id}{\ent}
+\sinonimo{\carga}{\ent}
+\sinonimo{\ancho}{\ent}
+\sinonimo{\largo}{\ent}
+\enum{Parcela}{Cultivo, Granero, Casa}
+\enum{Producto}{Fertilizante, Plaguicida, PlaguicidaBajoConsumo, Herbicida, HerbicidaLargoAlcance}
+\enum{EstadoCultivo}{Reci\'enSembrado, EnCrecimiento, ListoParaCosechar, ConMaleza, ConPlaga, NoSensado}