├── 2019 ├── 1erParcial-Enunciado.txt ├── Recuperatorio-Enunciado.txt └── 2doParcial-Enunciado.txt ├── README.md ├── 2021-1c ├── 1erParcial │ ├── Readme.txt │ ├── ISW1-2021-1C-1erParcial-11Parcial.st │ ├── ISW1-2021-1C-Parcial-Enunciado.pdf │ └── ISW1-2021-1C-1erParcial-11Resolucion.st ├── 2doParcial │ ├── ISW1-2021-1C-2doParcial.st │ ├── ISW1-2021-1C-2doParcial-Resolucion.st │ ├── ISW1-2021-1C-Parcial-2-Enunciado de Truco.pdf │ ├── ISW1-2021-1C-2doParcial-Resolucion-ConRondaDeTrucoYJugador.st │ ├── ISW1-2021-1C-2doParcial-Resolucion-ConRondaDeTrucoyTurno.st │ └── ISW1-2021-1C-2doParcial-Resolucion-SoloReificandoRondaDeTruco.st └── Recuperatorio │ ├── ISW1-2021-1C-Recuperatorio-SoloConRonda.st │ ├── ISW1-2021-1C-Recuperatorio-ConRondaYJugador.st │ ├── ISW1-2021-1C-Recuperatorio-Enunciado de Truco.pdf │ ├── ISW1-2021-1C-Recuperatorio-ConEnfrentamientoYEstado.st │ └── ISW1-2021-1C-Recuperatorio-ConRondaYJugador-Solucion.st ├── 2022-1c ├── Recu2doParcial │ ├── LinkAVideo.txt │ └── ISW1-2022-1C-Recuperatorio-Enunciado.pdf ├── Recu1erParcial │ ├── LinkAVideo.txt │ └── ISW1-2022-1C-Recuperatorio-Enunciado.pdf ├── 1erParcial │ ├── ISW1-2022-1C-Parcial-1-Resolucion.st │ ├── ISW1-2022-2C-Parcial-1-Enunciado.pdf │ └── LinkAVideo.txt └── 2doParcial │ ├── ISW1-2022-1C-Parcial-2-Enunciado.pdf │ └── LinkAVideo.txt ├── 2024-1c ├── 2doParcial │ ├── LinkAVideo.txt │ └── ISW1-2024-1C-2doParcial-Practica.pdf ├── Recuperatorio │ ├── LinkAVideo.txt │ └── ISW1-2024-1C-Recupeatorio.pdf └── 1erParcial │ ├── ISW1-2024-1C-1erParcial-Practica.pdf │ └── VideoDeSolucion.md ├── 2025-2c ├── Recu │ ├── Video.txt │ ├── 2025-2C-Recuperatorio-Práctica.pdf │ └── 2025-2C-Recuperatorio-Original.st ├── 2doParcial │ ├── .DS_Store │ ├── 2025-2C-2doParcial-Práctica.pdf │ ├── 2025-2C-2doParcial-Teórica.pdf │ ├── Video.txt │ └── 2025-2C-2doParcial-Original.st └── 1erParcial │ ├── 2025-2C-1erParcial-Práctica.pdf │ └── 2025-2C-1erParcial-Teórica.pdf ├── 2022-2c ├── 1erParcial │ ├── VideoDeSolucion.txt │ ├── ISW1-2022-2C-1erParcial.st │ ├── ISW1-2022-2C-1erParcial-Solucion.st │ └── ISW1-2022-2C-Parcial-1-Enunciado.pdf ├── .DS_Store ├── 2doParcial │ ├── ISW1-2022-2C-2doParcial.st │ └── ISW1-2022-2C-Parcial-2-Enunciado.pdf └── Recuperatorio │ └── ISW1-2022-2C-Recuperatorio-Enunciado.pdf ├── 2020-2c ├── 1erParcial │ ├── Readme.txt │ └── ISW1-2020-2C-Parcial-Enunciado.pdf ├── recuperatorio │ ├── ISW1-2020-2C-Recuperatorio1erParcial.pdf │ └── ISW1-2020-2C-Recuperatorio2doParcial.pdf └── 2doParcial │ └── Hernan-ISW1-2020-2C-Parcial2-Enunciado-AdventureGamesII.pdf ├── 2021-2c ├── 1erParcial │ ├── LinkAVideo.txt │ ├── ISW1-2021-2C-1erParcial.st │ ├── ISW1-2021-2C-1erParcial-Solution.st │ └── ISW1-2021-2C-Parcial-1-Enunciado.pdf ├── 2doParcial │ └── ISW1-2021-2C-Parcial-2-Enunciado.pdf └── Recuperatorio │ ├── ISW1-2021-2C-Recuperatorio-1erParcial.st │ ├── ISW1-2021-2C-Recuperatorio-Enunciado.pdf │ ├── ISW1-2021-2C-Recuperatorio-1erParcial-Solucion.st │ └── ISW1-2021-2C-Recuperatorio-2doParcial-Solucion.st ├── 2018-2c ├── 2doParcial-2c2018.pdf └── Recuperatorio-2c2018.pdf ├── 2025-1c ├── Recuperatorio │ ├── 2025-1C-Recu-Teórica.pdf │ └── 2025-1C-Recu1-Práctica.pdf ├── 1erParcial │ ├── 2025-1C-Parcial 1-Teórica.pdf │ └── 2025-1C-Parcial1-Práctica.pdf └── 2doParcial │ ├── 2025-1C-Parcial 2 - Teórica.pdf │ ├── 2025-1C-Parcial 2 - Práctica.pdf │ └── 2025-1C-Parcial-2.st ├── 2024-2c ├── 1erParcial │ ├── 2024-2C-Parcial 1 - Teórica.pdf │ ├── 2024-2C-Parcial 1 - Práctica.pdf │ ├── 2024-2C-Parcial 1 Paso a paso con bonus.zip │ ├── Readme.txt │ ├── 6509-FixBrokenChangesOn-SaveAs-overwritingImage-JuanVuletich-2024Jul08-16h21m-jmv.001.cs.st │ └── 2024-2C-Parcial-1.st ├── 2doParcial │ ├── 2024-2C-Parcial 2 - Teórica.pdf │ ├── 2024-2C-Parcial 2 - Práctica.pdf │ ├── Readme.txt │ └── TomasRodriguezNadin-Fix-GhostOverPill.cs.st └── Recuperatorio │ ├── 2024-2C-Recu - Teórica.pdf │ └── 2024-2C-Recuperatorio - Práctica.pdf ├── 2020-1c ├── 1erParcial │ ├── ISW1-2020-1C-Parcial-Enunciado.st │ ├── ISW1-2020-1C-Parcial-Solucion.st │ └── ISW1-2020-1C-Parcial-Enunciado.md ├── 2doParcial │ ├── 2do parcial - Enunciado Tema1.pdf │ ├── 2do parcial - Enunciado Tema2.pdf │ ├── ISW1-2020-1C-2doParcial-SolucionDeVideo.st │ ├── ISW1-2020-1C-2doParcial-CodigoParaEmpezar.st │ ├── ISW1-2020-1C-2doParcial-SolucionDecoratorRobotShipper.st │ └── README.txt └── Recuperatorios │ ├── IS1-1C2020-Recuperatorio.pdf │ ├── ISW1-2020-1C-Recuperatorio.st │ ├── ISW1-2020-1C-Recu1erParcial.Enunciado.pdf │ ├── README.TXT │ └── ISW1-2020-1C-Recu1erParcial.st ├── 2023-1c ├── 2doParcial │ └── ISW1-2023-1C-Parcial-2-Enunciado.pdf ├── Recuperatorio │ ├── ISW1-2023-1C-Recuperatorio-Enunciado.pdf │ └── Readme.txt └── 1erParcial │ ├── ISW1-2023-1C-1erParcial-ISW1-Perforaciones.pdf │ └── VideoDeSolucion-Comentarios.txt ├── 2023-2c ├── 2doParcial │ └── ISW1-2023-2C-Parcial-2-Enunciado.pdf ├── 1erParcial │ └── ISW1-2023-2C-1erParcial-ISW1-Penales.pdf └── Recuperatorio │ └── ISW1-2023-2C-Recuperatorio-Enunciado.pdf ├── 2019-2c ├── Recu │ ├── Readme.txt │ └── Enunciado.txt ├── 2doParcial │ ├── Readme.txt │ ├── Enunciado.txt │ └── MarsRover-IS1-2Parcial-2c2019.st └── 1erParcial │ ├── Enunciado.txt │ └── IngSof1-2019-2C-1Parcial.st ├── 1c2018 ├── Recuperatorio-Enunciado.txt └── 2doParcial-Enunciado.txt ├── 2018-1c ├── Recuperatorio-Enunciado.txt ├── 2doParcial-Enunciado.txt ├── MarsRover29.st └── MarsRover-With MarsRoverPosition Hierarchy.st └── 2019-1c ├── 1erParcial-Enunciado.txt ├── Recuperatorio-Enunciado.txt ├── 2doParcial-Enunciado-ConMasFuncionalidad.txt ├── Recuperatorio-Enunciado-ConMasFuncionalidad.txt ├── 2doParcial-Enunciado.txt ├── Recuperatorio-SolucionDeVideo.st └── 2doParcial-SolucionDeVideo.st /README.md: -------------------------------------------------------------------------------- 1 | # Parciales 2 | -------------------------------------------------------------------------------- /2021-1c/1erParcial/Readme.txt: -------------------------------------------------------------------------------- 1 | https://youtu.be/gxGNaUx90n0 2 | -------------------------------------------------------------------------------- /2022-1c/Recu2doParcial/LinkAVideo.txt: -------------------------------------------------------------------------------- 1 | https://youtu.be/cDqEGjXYZF4 -------------------------------------------------------------------------------- /2024-1c/2doParcial/LinkAVideo.txt: -------------------------------------------------------------------------------- 1 | https://youtu.be/99ekhmMLRJo 2 | -------------------------------------------------------------------------------- /2024-1c/Recuperatorio/LinkAVideo.txt: -------------------------------------------------------------------------------- 1 | https://youtu.be/uMAb8xmg-1g -------------------------------------------------------------------------------- /2025-2c/Recu/Video.txt: -------------------------------------------------------------------------------- 1 | Link a video: https://youtu.be/QndxgGy0kPQ -------------------------------------------------------------------------------- /2022-2c/1erParcial/VideoDeSolucion.txt: -------------------------------------------------------------------------------- 1 | https://youtu.be/kFzo4NsqZlI 2 | -------------------------------------------------------------------------------- /2022-1c/Recu1erParcial/LinkAVideo.txt: -------------------------------------------------------------------------------- 1 | https://www.youtube.com/watch?v=ti7sQ2KgtWE -------------------------------------------------------------------------------- /2020-2c/1erParcial/Readme.txt: -------------------------------------------------------------------------------- 1 | Link a video con solucion: https://youtu.be/y3q7TxsKyFA 2 | -------------------------------------------------------------------------------- /2021-2c/1erParcial/LinkAVideo.txt: -------------------------------------------------------------------------------- 1 | Video de la Resolución: https://youtu.be/vZhERguCujg 2 | -------------------------------------------------------------------------------- /2022-2c/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-2c/.DS_Store -------------------------------------------------------------------------------- /2018-2c/2doParcial-2c2018.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2018-2c/2doParcial-2c2018.pdf -------------------------------------------------------------------------------- /2025-2c/2doParcial/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-2c/2doParcial/.DS_Store -------------------------------------------------------------------------------- /2018-2c/Recuperatorio-2c2018.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2018-2c/Recuperatorio-2c2018.pdf -------------------------------------------------------------------------------- /2021-1c/2doParcial/ISW1-2021-1C-2doParcial.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/2doParcial/ISW1-2021-1C-2doParcial.st -------------------------------------------------------------------------------- /2021-2c/1erParcial/ISW1-2021-2C-1erParcial.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/1erParcial/ISW1-2021-2C-1erParcial.st -------------------------------------------------------------------------------- /2022-2c/1erParcial/ISW1-2022-2C-1erParcial.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-2c/1erParcial/ISW1-2022-2C-1erParcial.st -------------------------------------------------------------------------------- /2022-2c/2doParcial/ISW1-2022-2C-2doParcial.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-2c/2doParcial/ISW1-2022-2C-2doParcial.st -------------------------------------------------------------------------------- /2025-1c/Recuperatorio/2025-1C-Recu-Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-1c/Recuperatorio/2025-1C-Recu-Teórica.pdf -------------------------------------------------------------------------------- /2025-2c/Recu/2025-2C-Recuperatorio-Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-2c/Recu/2025-2C-Recuperatorio-Práctica.pdf -------------------------------------------------------------------------------- /2024-2c/1erParcial/2024-2C-Parcial 1 - Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-2c/1erParcial/2024-2C-Parcial 1 - Teórica.pdf -------------------------------------------------------------------------------- /2024-2c/2doParcial/2024-2C-Parcial 2 - Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-2c/2doParcial/2024-2C-Parcial 2 - Teórica.pdf -------------------------------------------------------------------------------- /2024-2c/Recuperatorio/2024-2C-Recu - Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-2c/Recuperatorio/2024-2C-Recu - Teórica.pdf -------------------------------------------------------------------------------- /2025-1c/1erParcial/2025-1C-Parcial 1-Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-1c/1erParcial/2025-1C-Parcial 1-Teórica.pdf -------------------------------------------------------------------------------- /2025-1c/1erParcial/2025-1C-Parcial1-Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-1c/1erParcial/2025-1C-Parcial1-Práctica.pdf -------------------------------------------------------------------------------- /2025-1c/2doParcial/2025-1C-Parcial 2 - Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-1c/2doParcial/2025-1C-Parcial 2 - Teórica.pdf -------------------------------------------------------------------------------- /2025-1c/Recuperatorio/2025-1C-Recu1-Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-1c/Recuperatorio/2025-1C-Recu1-Práctica.pdf -------------------------------------------------------------------------------- /2025-2c/1erParcial/2025-2C-1erParcial-Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-2c/1erParcial/2025-2C-1erParcial-Práctica.pdf -------------------------------------------------------------------------------- /2025-2c/1erParcial/2025-2C-1erParcial-Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-2c/1erParcial/2025-2C-1erParcial-Teórica.pdf -------------------------------------------------------------------------------- /2025-2c/2doParcial/2025-2C-2doParcial-Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-2c/2doParcial/2025-2C-2doParcial-Práctica.pdf -------------------------------------------------------------------------------- /2025-2c/2doParcial/2025-2C-2doParcial-Teórica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-2c/2doParcial/2025-2C-2doParcial-Teórica.pdf -------------------------------------------------------------------------------- /2020-1c/1erParcial/ISW1-2020-1C-Parcial-Enunciado.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/1erParcial/ISW1-2020-1C-Parcial-Enunciado.st -------------------------------------------------------------------------------- /2020-1c/1erParcial/ISW1-2020-1C-Parcial-Solucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/1erParcial/ISW1-2020-1C-Parcial-Solucion.st -------------------------------------------------------------------------------- /2020-1c/2doParcial/2do parcial - Enunciado Tema1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/2doParcial/2do parcial - Enunciado Tema1.pdf -------------------------------------------------------------------------------- /2020-1c/2doParcial/2do parcial - Enunciado Tema2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/2doParcial/2do parcial - Enunciado Tema2.pdf -------------------------------------------------------------------------------- /2020-1c/Recuperatorios/IS1-1C2020-Recuperatorio.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/Recuperatorios/IS1-1C2020-Recuperatorio.pdf -------------------------------------------------------------------------------- /2020-1c/Recuperatorios/ISW1-2020-1C-Recuperatorio.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/Recuperatorios/ISW1-2020-1C-Recuperatorio.st -------------------------------------------------------------------------------- /2024-1c/Recuperatorio/ISW1-2024-1C-Recupeatorio.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-1c/Recuperatorio/ISW1-2024-1C-Recupeatorio.pdf -------------------------------------------------------------------------------- /2024-2c/1erParcial/2024-2C-Parcial 1 - Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-2c/1erParcial/2024-2C-Parcial 1 - Práctica.pdf -------------------------------------------------------------------------------- /2024-2c/2doParcial/2024-2C-Parcial 2 - Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-2c/2doParcial/2024-2C-Parcial 2 - Práctica.pdf -------------------------------------------------------------------------------- /2025-1c/2doParcial/2025-1C-Parcial 2 - Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2025-1c/2doParcial/2025-1C-Parcial 2 - Práctica.pdf -------------------------------------------------------------------------------- /2020-2c/1erParcial/ISW1-2020-2C-Parcial-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-2c/1erParcial/ISW1-2020-2C-Parcial-Enunciado.pdf -------------------------------------------------------------------------------- /2021-1c/1erParcial/ISW1-2021-1C-1erParcial-11Parcial.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/1erParcial/ISW1-2021-1C-1erParcial-11Parcial.st -------------------------------------------------------------------------------- /2021-1c/1erParcial/ISW1-2021-1C-Parcial-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/1erParcial/ISW1-2021-1C-Parcial-Enunciado.pdf -------------------------------------------------------------------------------- /2021-2c/1erParcial/ISW1-2021-2C-1erParcial-Solution.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/1erParcial/ISW1-2021-2C-1erParcial-Solution.st -------------------------------------------------------------------------------- /2021-2c/1erParcial/ISW1-2021-2C-Parcial-1-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/1erParcial/ISW1-2021-2C-Parcial-1-Enunciado.pdf -------------------------------------------------------------------------------- /2021-2c/2doParcial/ISW1-2021-2C-Parcial-2-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/2doParcial/ISW1-2021-2C-Parcial-2-Enunciado.pdf -------------------------------------------------------------------------------- /2022-1c/1erParcial/ISW1-2022-1C-Parcial-1-Resolucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-1c/1erParcial/ISW1-2022-1C-Parcial-1-Resolucion.st -------------------------------------------------------------------------------- /2022-1c/1erParcial/ISW1-2022-2C-Parcial-1-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-1c/1erParcial/ISW1-2022-2C-Parcial-1-Enunciado.pdf -------------------------------------------------------------------------------- /2022-1c/2doParcial/ISW1-2022-1C-Parcial-2-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-1c/2doParcial/ISW1-2022-1C-Parcial-2-Enunciado.pdf -------------------------------------------------------------------------------- /2022-2c/1erParcial/ISW1-2022-2C-1erParcial-Solucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-2c/1erParcial/ISW1-2022-2C-1erParcial-Solucion.st -------------------------------------------------------------------------------- /2022-2c/1erParcial/ISW1-2022-2C-Parcial-1-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-2c/1erParcial/ISW1-2022-2C-Parcial-1-Enunciado.pdf -------------------------------------------------------------------------------- /2022-2c/2doParcial/ISW1-2022-2C-Parcial-2-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-2c/2doParcial/ISW1-2022-2C-Parcial-2-Enunciado.pdf -------------------------------------------------------------------------------- /2023-1c/2doParcial/ISW1-2023-1C-Parcial-2-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2023-1c/2doParcial/ISW1-2023-1C-Parcial-2-Enunciado.pdf -------------------------------------------------------------------------------- /2023-2c/2doParcial/ISW1-2023-2C-Parcial-2-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2023-2c/2doParcial/ISW1-2023-2C-Parcial-2-Enunciado.pdf -------------------------------------------------------------------------------- /2024-1c/1erParcial/ISW1-2024-1C-1erParcial-Practica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-1c/1erParcial/ISW1-2024-1C-1erParcial-Practica.pdf -------------------------------------------------------------------------------- /2024-1c/2doParcial/ISW1-2024-1C-2doParcial-Practica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-1c/2doParcial/ISW1-2024-1C-2doParcial-Practica.pdf -------------------------------------------------------------------------------- /2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion.st -------------------------------------------------------------------------------- /2021-1c/1erParcial/ISW1-2021-1C-1erParcial-11Resolucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/1erParcial/ISW1-2021-1C-1erParcial-11Resolucion.st -------------------------------------------------------------------------------- /2022-1c/2doParcial/LinkAVideo.txt: -------------------------------------------------------------------------------- 1 | https://youtu.be/2VpynWnpX3g 2 | Hay dos códigos con la solución, uno hecho antes del video y otro con el video. Hay diferencias mínimas entre ellos. -------------------------------------------------------------------------------- /2023-2c/1erParcial/ISW1-2023-2C-1erParcial-ISW1-Penales.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2023-2c/1erParcial/ISW1-2023-2C-1erParcial-ISW1-Penales.pdf -------------------------------------------------------------------------------- /2024-2c/Recuperatorio/2024-2C-Recuperatorio - Práctica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-2c/Recuperatorio/2024-2C-Recuperatorio - Práctica.pdf -------------------------------------------------------------------------------- /2020-1c/2doParcial/ISW1-2020-1C-2doParcial-SolucionDeVideo.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/2doParcial/ISW1-2020-1C-2doParcial-SolucionDeVideo.st -------------------------------------------------------------------------------- /2020-2c/recuperatorio/ISW1-2020-2C-Recuperatorio1erParcial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-2c/recuperatorio/ISW1-2020-2C-Recuperatorio1erParcial.pdf -------------------------------------------------------------------------------- /2020-2c/recuperatorio/ISW1-2020-2C-Recuperatorio2doParcial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-2c/recuperatorio/ISW1-2020-2C-Recuperatorio2doParcial.pdf -------------------------------------------------------------------------------- /2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-1erParcial.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-1erParcial.st -------------------------------------------------------------------------------- /2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-Enunciado.pdf -------------------------------------------------------------------------------- /2022-2c/Recuperatorio/ISW1-2022-2C-Recuperatorio-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-2c/Recuperatorio/ISW1-2022-2C-Recuperatorio-Enunciado.pdf -------------------------------------------------------------------------------- /2023-1c/Recuperatorio/ISW1-2023-1C-Recuperatorio-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2023-1c/Recuperatorio/ISW1-2023-1C-Recuperatorio-Enunciado.pdf -------------------------------------------------------------------------------- /2023-2c/Recuperatorio/ISW1-2023-2C-Recuperatorio-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2023-2c/Recuperatorio/ISW1-2023-2C-Recuperatorio-Enunciado.pdf -------------------------------------------------------------------------------- /2024-2c/1erParcial/2024-2C-Parcial 1 Paso a paso con bonus.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2024-2c/1erParcial/2024-2C-Parcial 1 Paso a paso con bonus.zip -------------------------------------------------------------------------------- /2020-1c/2doParcial/ISW1-2020-1C-2doParcial-CodigoParaEmpezar.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/2doParcial/ISW1-2020-1C-2doParcial-CodigoParaEmpezar.st -------------------------------------------------------------------------------- /2020-1c/Recuperatorios/ISW1-2020-1C-Recu1erParcial.Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/Recuperatorios/ISW1-2020-1C-Recu1erParcial.Enunciado.pdf -------------------------------------------------------------------------------- /2021-1c/2doParcial/ISW1-2021-1C-Parcial-2-Enunciado de Truco.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/2doParcial/ISW1-2021-1C-Parcial-2-Enunciado de Truco.pdf -------------------------------------------------------------------------------- /2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-SoloConRonda.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-SoloConRonda.st -------------------------------------------------------------------------------- /2022-1c/Recu1erParcial/ISW1-2022-1C-Recuperatorio-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-1c/Recu1erParcial/ISW1-2022-1C-Recuperatorio-Enunciado.pdf -------------------------------------------------------------------------------- /2022-1c/Recu2doParcial/ISW1-2022-1C-Recuperatorio-Enunciado.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2022-1c/Recu2doParcial/ISW1-2022-1C-Recuperatorio-Enunciado.pdf -------------------------------------------------------------------------------- /2023-1c/1erParcial/ISW1-2023-1C-1erParcial-ISW1-Perforaciones.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2023-1c/1erParcial/ISW1-2023-1C-1erParcial-ISW1-Perforaciones.pdf -------------------------------------------------------------------------------- /2019-2c/Recu/Readme.txt: -------------------------------------------------------------------------------- 1 | Video: https://youtu.be/g8pgp7mSJNA 2 | 3 | Lamentablemente se me colgo QuictTime a la hora 1:22 aprox, por lo que hay toda una parte de refactorización que se perdió en el video -------------------------------------------------------------------------------- /2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-ConRondaYJugador.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-ConRondaYJugador.st -------------------------------------------------------------------------------- /2025-1c/2doParcial/2025-1C-Parcial-2.st: -------------------------------------------------------------------------------- 1 | Feature require: 'WebClient'! 2 | (SystemOrganization categoriesMatching: '2025-1C-Parcial-22') ifEmpty: [ SystemOrganization addCategory: #'2025-1C-Parcial-2' ]! -------------------------------------------------------------------------------- /2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-Enunciado de Truco.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-Enunciado de Truco.pdf -------------------------------------------------------------------------------- /2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-1erParcial-Solucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-1erParcial-Solucion.st -------------------------------------------------------------------------------- /2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-2doParcial-Solucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-2c/Recuperatorio/ISW1-2021-2C-Recuperatorio-2doParcial-Solucion.st -------------------------------------------------------------------------------- /2020-1c/2doParcial/ISW1-2020-1C-2doParcial-SolucionDecoratorRobotShipper.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-1c/2doParcial/ISW1-2020-1C-2doParcial-SolucionDecoratorRobotShipper.st -------------------------------------------------------------------------------- /2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-ConEnfrentamientoYEstado.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-ConEnfrentamientoYEstado.st -------------------------------------------------------------------------------- /2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-ConRondaYJugador-Solucion.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/Recuperatorio/ISW1-2021-1C-Recuperatorio-ConRondaYJugador-Solucion.st -------------------------------------------------------------------------------- /2024-1c/1erParcial/VideoDeSolucion.md: -------------------------------------------------------------------------------- 1 | Pueden ver el video de la solución en https://youtu.be/SDi_PUEtk-E 2 | 3 | [![Video](https://img.youtube.com/vi/SDi_PUEtk-E/sddefault.jpg)](https://youtu.be//SDi_PUEtk-E) 4 | -------------------------------------------------------------------------------- /2020-2c/2doParcial/Hernan-ISW1-2020-2C-Parcial2-Enunciado-AdventureGamesII.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2020-2c/2doParcial/Hernan-ISW1-2020-2C-Parcial2-Enunciado-AdventureGamesII.pdf -------------------------------------------------------------------------------- /2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion-ConRondaDeTrucoYJugador.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion-ConRondaDeTrucoYJugador.st -------------------------------------------------------------------------------- /2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion-ConRondaDeTrucoyTurno.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion-ConRondaDeTrucoyTurno.st -------------------------------------------------------------------------------- /2022-1c/1erParcial/LinkAVideo.txt: -------------------------------------------------------------------------------- 1 | Video de la Resolución: https://www.youtube.com/watch?v=X0uQ9FCjXhY 2 | Hay dos códigos con la solución, uno hecho antes del video y otro con el video. Hay diferencias mínimas entre ellos. -------------------------------------------------------------------------------- /2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion-SoloReificandoRondaDeTruco.st: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UBA-FCEN-IngSoft1/Parciales/HEAD/2021-1c/2doParcial/ISW1-2021-1C-2doParcial-Resolucion-SoloReificandoRondaDeTruco.st -------------------------------------------------------------------------------- /2023-1c/Recuperatorio/Readme.txt: -------------------------------------------------------------------------------- 1 | La solución de alumno es de Tomás Mengoni que hizo el recuerdo del primer parcial, o sea que no incluye lo del modo de consumo y es una linda solución, por eso la estamos compartiendo. 2 | Gracias Tomás por permitirnos subirla -------------------------------------------------------------------------------- /2024-2c/1erParcial/Readme.txt: -------------------------------------------------------------------------------- 1 | Este parcial fue tomando en simultáneo con la FIUBA. 2 | Link a video hecho por Luciano Leveroni, profesor de FIUBA: https://www.youtube.com/watch?v=Kroqdo4MQhE 3 | La solución paso a paso también fue hecha por él. 4 | Gracias Lucho!! 5 | -------------------------------------------------------------------------------- /2025-2c/2doParcial/Video.txt: -------------------------------------------------------------------------------- 1 | Link a video: https://youtu.be/7jSwQvG6sxI 2 | Comentarios: 3 | - A la solución del video le falta verificar que el trasbordo no aplique sobre un descuento 4 | - La solución cobrar mal la salida de tren para jubilado en el segundo viaje (caso muy particular) 5 | -------------------------------------------------------------------------------- /2020-1c/Recuperatorios/README.TXT: -------------------------------------------------------------------------------- 1 | La solución final tiene un par de renames y categorizaciones de mensajes que no están en el video. 2 | Para hacer el ejercicio hay que partir de la solución del 2do parcial 3 | Acabo de ver que hay una parte final del video donde refectorio la solución categorizando métodos y arreglo un par de errores que había que no quedo... Igual el código si incluye esas modificaciones -------------------------------------------------------------------------------- /2019-2c/2doParcial/Readme.txt: -------------------------------------------------------------------------------- 1 | La solucion tiene un punto distinto al enunciado. 2 | Al momento de hacer la solucion en el enunciado se pedia que la rotación sobre hielo también fuese impredesible, pero luego se saco ese requerimiento para hacer la solución más simple. 3 | Por lo tanto, en el código de la solución como en el video de la solución tiene resuelto ese punto que no se pidió finalmente hacer. 4 | 5 | Video: https://youtu.be/1UYYR95T1no 6 | -------------------------------------------------------------------------------- /2023-1c/1erParcial/VideoDeSolucion-Comentarios.txt: -------------------------------------------------------------------------------- 1 | Video: https://www.youtube.com/watch?v=ljLpbLJ42LY 2 | 3 | Comentarios: 4 | - En vez de tener MechaRota hubiese sido mejor representar que la mecha está rota o no con un state de la mecha 5 | - La solución ISW1-2023-1C-Parcial-1-SinScanNiEsnnn.st saca los mensajes: 6 | - scan Estaban solo por temas de ejercicio, pero en realidad no son necesarios para la resolución de lo que se hace 7 | - esArenoso, esConcreto, esTierra Estos mensajes no son necesarios al usar la clase como tipo de suelo 8 | -------------------------------------------------------------------------------- /2024-2c/2doParcial/Readme.txt: -------------------------------------------------------------------------------- 1 | El alumno Tomas Rodriguez Nadin encontró un error en la resolución que se da cuando un fantasma está sobre una píldora y se pregunta si el juego está terminado. 2 | En la resolución que yo armé daría que el juego está terminado cuando no es así. 3 | Su propuesta de solución está en el change set TomasRodriguezNadin-Fix-GhostOverPill.cs.st 4 | Yo arme una un poco distinta que está en la solución completa 2024-2C-Parcial-2-Solucion-ConGhostOverPill.st 5 | 6 | Que haya pasado esto está bueno porque muestra cómo hasta en cosas tan simples se oculta la complejidad, que el testing no implica ausencia de errores y que todos podemos cometer errores, hasta el profesor!!!! jajaja. 7 | -------------------------------------------------------------------------------- /2024-2c/2doParcial/TomasRodriguezNadin-Fix-GhostOverPill.cs.st: -------------------------------------------------------------------------------- 1 | 'From Cuis6.3 [latest update: #6350] on 3 December 2024 at 9:26:36 am'! 2 | 3 | !PacmanGameTest methodsFor: 'tests' stamp: 'TRN 12/3/2024 01:40:03'! 4 | test24GameIsNotOverWhenGhostsHoverOverPills 5 | 6 | | board game | 7 | 8 | board := StringPacmanBoard representedAs:#( 9 | '#####' 10 | '#-BC#' 11 | '#*-p#' 12 | '#####'). 13 | 14 | nextIntegers := ReadStream on: #(). 15 | game := PacmanGame on: board randomizingWith: self. 16 | 4 timesRepeat: [game tick]. 17 | 18 | self deny: game isOver. 19 | self assert: game stringRepresentationOfBoard equals:#( 20 | '#####' 21 | '#B=C#' 22 | '#p==#' 23 | '#####') . 24 | ! ! 25 | 26 | 27 | !PacmanElement methodsFor: 'testing' stamp: 'TRN 12/3/2024 01:39:09'! 28 | isOrIsOnPill 29 | 30 | ^false! ! 31 | 32 | 33 | !Ghost methodsFor: 'testing' stamp: 'TRN 12/3/2024 01:39:39'! 34 | isOrIsOnPill 35 | 36 | ^previousElement isOrIsOnPill ! ! 37 | 38 | 39 | !Pill methodsFor: 'testing' stamp: 'TRN 12/3/2024 01:39:09'! 40 | isOrIsOnPill 41 | 42 | ^true! ! 43 | 44 | 45 | !PacmanGame methodsFor: 'testing' stamp: 'TRN 12/3/2024 01:39:09'! 46 | areThereNoPills 47 | 48 | ^board allSatisfy: [ :aPacmanElement | aPacmanElement isOrIsOnPill not ]! ! 49 | 50 | -------------------------------------------------------------------------------- /2020-1c/2doParcial/README.txt: -------------------------------------------------------------------------------- 1 | Video de la solución: https://youtu.be/ez0kDLoeVLk 2 | 3 | Comentarios sobre la solución alternativa ISW1-2020-1C-2doParcial-SolucionDecoratorRobotShipper.st: 4 | 5 | El primer punto (limpieza de productos/empaque de productos) evita modificar la clase Trailer utilizando un decorator para resolver el problema. Adicionalmente, la modificación del indice de contaminación/protección la hace a través de un mensaje que reduce/incrementa tal valor por otro. Esta forma de hacerlo evita el acoplamiento de los productos con los limpiadores, aunque está al borde de violar encapsulamiento del producto. Ambas maneras consideramos válidas de todas maneras. 6 | 7 | Con respecto al segundo punto, esta solución decide no modelar el centro de distribución, y por lo tanto no otorgarle responsabilidades, y en cambio sólo se queda con no es más que una colección de vehículos. ¿Quién se encarga de responder el mensaje #ship:...? En este caso es el robot a quien se le indica que debe shippear su trailer y debe elegir algún vehículo de la colección de vehículos para depositarlo. 8 | 9 | Por último, la solución va un poquito más allá de lo pedido en el enunciado del parcial, e intenta solucionar que pasa si un robot sin trailer o que ya shippeo se le ordena ir a tomar un producto o cerrar una orden o volver a shippear. Esto no era pedido en el parcial (creo que el último párrafo del mismo lo aclaraba), pero lo dejamos en esta solución como curiosidad. 10 | -------------------------------------------------------------------------------- /1c2018/Recuperatorio-Enunciado.txt: -------------------------------------------------------------------------------- 1 | 1) Preguntas Teóricas: 2 | Completar el siguiente formulario: https://goo.gl/forms/TaVWD7KWwrxDKBRb2 3 | 4 | 2) Ejercicio Práctico: 5 | Desarrollar el sistema que cumpla con el requerimiento a continuacion, usando TDD y las buenas practicas de programacion y diseño que vimos en la materia. 6 | 7 | Reserva de Cochera 8 | Una empresa quiere mejorar la distribucion de uso de la unica cochera que tienen entre sus empleados. Para eso nos piden hacer un programa para que decida quien debe usar la cochera en base a los pedidos de uso que hubo de ella. 9 | El sistema debe permitir recibir pedidos de reserva a una fecha, una persona, y con algun motivo. 10 | Los motivos pueden ser: 1) Tengo reunion con cliente 2) Tengo que dar una clase 3) Uso personal. 11 | Una vez por dor dia se cierra la reserva del dia. Esto significa que no se recibiran mas pedidos para esa fecha y se decide quien debe usar la cochera. 12 | La asignacion de la cochera se hace de la siguiente forma: 13 | 1) si hay un solo pedido, se le otorga a esa persona 14 | 2) si hay mas de uno, se prioriza por motivo. Tiene prioridad la reunion con el cliente, luego dar clase y por ultimo el uso personal. 15 | 3) si como resultado de 2) queda mas de un posible ganador, se le asigna al que menos veces uso la cochera en los ultimos 30 dias. 16 | Una vez que la cochera esta asignada, no se pueden aceptar mas pedidos a esa fecha. 17 | Si una persona hace mas de una reserva a una fecha, se descarta la que tenia y se toma la ultima 18 | -------------------------------------------------------------------------------- /2018-1c/Recuperatorio-Enunciado.txt: -------------------------------------------------------------------------------- 1 | 1) Preguntas Teóricas: 2 | Completar el siguiente formulario: https://goo.gl/forms/TaVWD7KWwrxDKBRb2 3 | 4 | 2) Ejercicio Práctico: 5 | Desarrollar el sistema que cumpla con el requerimiento a continuacion, usando TDD y las buenas practicas de programacion y diseño que vimos en la materia. 6 | 7 | Reserva de Cochera 8 | Una empresa quiere mejorar la distribucion de uso de la unica cochera que tienen entre sus empleados. Para eso nos piden hacer un programa para que decida quien debe usar la cochera en base a los pedidos de uso que hubo de ella. 9 | El sistema debe permitir recibir pedidos de reserva a una fecha, una persona, y con algun motivo. 10 | Los motivos pueden ser: 1) Tengo reunion con cliente 2) Tengo que dar una clase 3) Uso personal. 11 | Una vez por dor dia se cierra la reserva del dia. Esto significa que no se recibiran mas pedidos para esa fecha y se decide quien debe usar la cochera. 12 | La asignacion de la cochera se hace de la siguiente forma: 13 | 1) si hay un solo pedido, se le otorga a esa persona 14 | 2) si hay mas de uno, se prioriza por motivo. Tiene prioridad la reunion con el cliente, luego dar clase y por ultimo el uso personal. 15 | 3) si como resultado de 2) queda mas de un posible ganador, se le asigna al que menos veces uso la cochera en los ultimos 30 dias. 16 | Una vez que la cochera esta asignada, no se pueden aceptar mas pedidos a esa fecha. 17 | Si una persona hace mas de una reserva a una fecha, se descarta la que tenia y se toma la ultima 18 | -------------------------------------------------------------------------------- /2019/1erParcial-Enunciado.txt: -------------------------------------------------------------------------------- 1 | Una empresa dueña de muchos estacionamientos quiere implementar una simulación para mejorar el servicio a miras de ser la primera en poner un estacionamiento en Marte. 2 | En estos primeros pasos del proyecto necesitan un modelo computable con las siguientes características: 3 | • El estacionamiento tendrá una cantidad configurable de lugares. 4 | • En caso de tener una cantidad impar de lugares se debe reservar un lugar. El mismo será usado por el dueño del estacionamiento (el costo en este caso es $0). 5 | • En los lugares pueden estacionar autos o bicicletas (ésta es una simplificación de la vida real pero que sirve en esta primer instancia) 6 | • La empresa quiere saber cuánto dinero hay “estacionado” en un instante dado teniendo en cuenta que los valores de las estadías son: 7 | ◦ Autos: $100 8 | ◦ Bicicletass: $50
 9 | 10 | Por suerte ya hay bastante implementado de sistemas anteriores que podemos reutilizar, al igual que los tests, sin embargo para este caso hay que implementar la clase Slot y sacar el código repetido de la clase ParkingLot porque la escribió una persona sin mucha experiencia en programación. 11 | 12 | Trabajo a Realizar: 13 | 1. Implementar la clase Slot para que los tests de SlotTests pasen 14 | 2. La implementación de Slot no debe tener ifs cuando los mismos pueden ser reemplazados por polimorfismo 15 | 3. Una vez hecho 1 y 2, sacar el código repetido de la clase ParkingLot 16 | 4. Usar las heurísticas de diseño vistas hasta ahora (buenos nombres, métodos cortos, etc) 17 | 5. No se puede modificar los tests
 18 | -------------------------------------------------------------------------------- /2019-1c/1erParcial-Enunciado.txt: -------------------------------------------------------------------------------- 1 | Una empresa dueña de muchos estacionamientos quiere implementar una simulación para mejorar el servicio a miras de ser la primera en poner un estacionamiento en Marte. 2 | En estos primeros pasos del proyecto necesitan un modelo computable con las siguientes características: 3 | • El estacionamiento tendrá una cantidad configurable de lugares. 4 | • En caso de tener una cantidad impar de lugares se debe reservar un lugar. El mismo será usado por el dueño del estacionamiento (el costo en este caso es $0). 5 | • En los lugares pueden estacionar autos o bicicletas (ésta es una simplificación de la vida real pero que sirve en esta primer instancia) 6 | • La empresa quiere saber cuánto dinero hay “estacionado” en un instante dado teniendo en cuenta que los valores de las estadías son: 7 | ◦ Autos: $100 8 | ◦ Bicicletass: $50
 9 | 10 | Por suerte ya hay bastante implementado de sistemas anteriores que podemos reutilizar, al igual que los tests, sin embargo para este caso hay que implementar la clase Slot y sacar el código repetido de la clase ParkingLot porque la escribió una persona sin mucha experiencia en programación. 11 | 12 | Trabajo a Realizar: 13 | 1. Implementar la clase Slot para que los tests de SlotTests pasen 14 | 2. La implementación de Slot no debe tener ifs cuando los mismos pueden ser reemplazados por polimorfismo 15 | 3. Una vez hecho 1 y 2, sacar el código repetido de la clase ParkingLot 16 | 4. Usar las heurísticas de diseño vistas hasta ahora (buenos nombres, métodos cortos, etc) 17 | 5. No se puede modificar los tests
 18 | -------------------------------------------------------------------------------- /1c2018/2doParcial-Enunciado.txt: -------------------------------------------------------------------------------- 1 | 1) Preguntas Teóricas: 2 | Completar el siguiente formulario: https://goo.gl/forms/Q7bA91ouJtFJCrnn1 3 | 4 | 2) Ejercicio Práctico: 5 | Sos parte del equipo que desarrolla los equipos de exploración remota de Marte en la NASA y tenés que desarrollar el sistema que controle el Mars Rover. 6 | Para eso, se asume que la superficie de Marte es un plano y que se usan puntos para posicionar al Mars Rover en dicho plano, más un punto cardinal que indica hacia donde apunta. 7 | Debido a que Marte está muy lejos, siempre se le envían al Mars Rover un conjunto de comandos empaquetados en un String, donde cada caracter es un comando. 8 | Tener en cuenta que la comunicación puede tener problemas y pueden llegar comandos erróneos en cuyo caso se espera que no se sigan procesando los comandos restantes. 9 | Tener en cuenta que: 10 | - El Mars Rover siempre empieza en un punto inicial (x,y) y apuntando a un punto cardinal (N,S,E,O) 11 | - El rover recibe una secuencia de caracteres que representan comandos sobre como moverse 12 | - Los comandos pueden ser: 13 | f = mover hacia adelante un punto (forward) 14 | b = mover hacia atrás un punto (backwards) 15 | l = rotar 90 grados a la izquierda 16 | r = rotar 90 grados a la derecha 17 | 18 | Resolverlo por medio de TDD. 19 | Los tests tiene que numerarse a medida que los van haciendo. 20 | Parte importante de la evaluación será ver cómo hicieron el desarrollo iterativo/incremental y que casos de prueba realizaron. 21 | También se evaluará la aplicación de las heurísticas de diseño que se vieron durante toda la materia 22 | -------------------------------------------------------------------------------- /2018-1c/2doParcial-Enunciado.txt: -------------------------------------------------------------------------------- 1 | 1) Preguntas Teóricas: 2 | Completar el siguiente formulario: https://goo.gl/forms/Q7bA91ouJtFJCrnn1 3 | 4 | 2) Ejercicio Práctico: 5 | Sos parte del equipo que desarrolla los equipos de exploración remota de Marte en la NASA y tenés que desarrollar el sistema que controle el Mars Rover. 6 | Para eso, se asume que la superficie de Marte es un plano y que se usan puntos para posicionar al Mars Rover en dicho plano, más un punto cardinal que indica hacia donde apunta. 7 | Debido a que Marte está muy lejos, siempre se le envían al Mars Rover un conjunto de comandos empaquetados en un String, donde cada caracter es un comando. 8 | Tener en cuenta que la comunicación puede tener problemas y pueden llegar comandos erróneos en cuyo caso se espera que no se sigan procesando los comandos restantes. 9 | Tener en cuenta que: 10 | - El Mars Rover siempre empieza en un punto inicial (x,y) y apuntando a un punto cardinal (N,S,E,O) 11 | - El rover recibe una secuencia de caracteres que representan comandos sobre como moverse 12 | - Los comandos pueden ser: 13 | f = mover hacia adelante un punto (forward) 14 | b = mover hacia atrás un punto (backwards) 15 | l = rotar 90 grados a la izquierda 16 | r = rotar 90 grados a la derecha 17 | 18 | Resolverlo por medio de TDD. 19 | Los tests tiene que numerarse a medida que los van haciendo. 20 | Parte importante de la evaluación será ver cómo hicieron el desarrollo iterativo/incremental y que casos de prueba realizaron. 21 | También se evaluará la aplicación de las heurísticas de diseño que se vieron durante toda la materia 22 | -------------------------------------------------------------------------------- /2019-2c/Recu/Enunciado.txt: -------------------------------------------------------------------------------- 1 | Los integrantes del equipo encargado de monitorear al MarsRover 2 | (que en este momento pasea por Marte esquivando piedras y 3 | resbalando con hielo) son unos expertos jugadores de ajedrez y 4 | pasan muchas horas jugando a dicho juego y también a variantes del mismo! 5 | 6 | El último que se les ha ocurrido lo llama "El juego de las Torres" tiene las siguientes reglas: 7 | - En el juego se enfrentan 2 jugadores: uno con piezas blancas y el otro con piezas negras. 8 | - Se juega sobre un tablero de 8x8 (64 escaques). Las posiciones se nombran usando puntos (no como el juego de ajedrez), que van del 1@1 al 8@8 9 | - Comienza el jugador con las piezas blancas y se van alternando los turnos. 10 | - En cada turno, un jugador solo puede mover una pieza. 11 | - Cada jugador dispone de 2 torres 12 | - Las torres blancas empiezan en las posiciones 1@1 y 7@1. 13 | - Las torres negras empiezan en las posiciones 2@8 y 8@8. 14 | - Las torres se mueven horizontal o verticalmente 15 | - Al moverse no pueden saltar otra pieza 16 | - Cuando una torre come una torre enemiga, o sea que ocupa la posicion de la pieza enemiga, a diferencia del juego original no se la quita del 17 | tablero sino que regresa a su lugar original, pero con la salvedad que su movimiento será como máximo de 3 casillas durante las próximas 4 veces que esa pieza se mueva (luego pasa a moverse normalmente). 18 | - Cuando una torre es comida y vuelve a su posicion original, si la misma esta ocupada, se intentará ubicar en el siguiente lugar libre moviendo la pieza en el eje x hacia el centro. 19 | - Ganan las blancas si logran ubicar sus torres en la posicion 4@4 y 5@5. 20 | - Ganan las negras si logran ubicar sus torres en la posicion 4@5 y 5@4. 21 | -------------------------------------------------------------------------------- /2024-2c/1erParcial/6509-FixBrokenChangesOn-SaveAs-overwritingImage-JuanVuletich-2024Jul08-16h21m-jmv.001.cs.st: -------------------------------------------------------------------------------- 1 | 'From Cuis7.1 [latest update: #6507] on 8 July 2024 at 4:22:40 pm'! 2 | 3 | !SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jmv 7/8/2024 16:19:56'! 4 | saveAs: newName 5 | "Save the image under newName. Don't quit. 6 | See senders." 7 | 8 | (self fullNameForImageNamed: newName) = self imageName 9 | ifTrue: [ 10 | "If saving over the our own image file, call #saveImage instead." 11 | self saveImage ] 12 | ifFalse: [ 13 | "This method requires saving on a different file." 14 | self saveAs: newName clearAllClassState: false ].! ! 15 | 16 | 17 | !SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jmv 7/8/2024 16:16:02'! 18 | saveAs 19 | "Put up the 'saveAs' prompt, obtain a name, and save the image under that new name." 20 | 21 | self request: 'New file name?' initialAnswer: self imageName asFullFileEntry name do: [ :newName | 22 | ( 23 | "Either both files are new," 24 | ((self fullNameForImageNamed: newName) asFullFileEntry exists not 25 | and: [(self fullNameForChangesNamed: newName) asFullFileEntry exists not]) 26 | "Or user confirms overwriting them." 27 | or: [self confirm: ('{1} already exists. Overwrite?' format: {newName})] 28 | ) 29 | ifTrue: [ 30 | self saveAs: newName ]]. 31 | ! ! 32 | 33 | !SystemDictionary methodsFor: 'snapshot and quit' stamp: 'jmv 7/8/2024 16:10:17'! 34 | saveAs: newName clearAllClassState: clearAllStateFlag 35 | "Save the image under a new name. Don't quit. 36 | Note: newName must be different from current name. 37 | See senders." 38 | 39 | | newChangesName | 40 | self currentChangesName ifNotNil: [ :oldChangesName | 41 | self closeSourceFiles. "so copying the changes file will always work" 42 | newChangesName := self fullNameForChangesNamed: newName. 43 | FileIOAccessor default copy: oldChangesName asFullFileEntry to: newChangesName asFullFileEntry. 44 | ChangesInitialFileSize ifNotNil: [ 45 | oldChangesName asFullFileEntry appendStreamDo: [ :strm | strm truncate: ChangesInitialFileSize ]]]. 46 | 47 | ChangeSet zapAllChangeSets. 48 | self 49 | changeImageNameTo: (self fullNameForImageNamed: newName); 50 | closeSourceFiles; openSourceFiles; "so SNAPSHOT appears in new changes file" 51 | snapshot: true andQuit: false embedded: false clearAllClassState: clearAllStateFlag.! ! 52 | 53 | -------------------------------------------------------------------------------- /2019/Recuperatorio-Enunciado.txt: -------------------------------------------------------------------------------- 1 | Video de resolucion: https://www.youtube.com/watch?v=up_JqgZjDg8 2 | (El video fue hecho con un enunciado mas complejo pero que simplifique durante la realizacion del mismo) 3 | 4 | Debemos desarrollar el sistema de asignación de horarios de trabajo de los empleados de las tiendas de una empresa de comida rápida. 5 | El sistema debe permitir que los empleados asignen a su planilla de horarios de trabajo, la disponibilidad que tienen para trabajar por semana de la siguiente manera: 6 | 1) De un día de semana a otro, en cierta franja horaria. Por ejemplo: 7 | - Para la semana del 15/7/2019, de Lunes a Viernes, de 8 a 16 hrs. 8 | - Para la semana del 22/7/2019, de Jueves a Domingo, de 13 a 22 hrs. 9 | 2) Por días puntuales de la semana, en cierta franja horaria. Por ejemplo: 10 | - Para la semana del 15/7/2019, Lunes de 8 a 16 hrs, Martes de 10 a 18 hrs, Miércoles de 13 a 22 hrs, etc. 11 | 12 | El objetivo principal de la planilla de horario de trabajo de un empleado es la de responder si dicho empleado trabaja o no en cierta fecha y hora. Para el ejemplo 1), se espera los siguientes resultado: 13 | - Trabaja el 15/7/2019 a las 7:59:59? -> No 14 | - Trabaja el 15/7/2019 a las 8:00? -> Si 15 | - Trabaja el 15/7/2019 a las 9:30? -> Si 16 | - Trabaja el 15/7/2019 a las 16:00? -> No 17 | Nótese que el horario de trabajo excluye la última hora. 18 | 19 | Cada tienda conoce las planilla de trabajo de los empleados que trabajan en ella y esto es usado para que el gerente de la tienda pueda conocer en una semana particular, qué horarios no están cubiertos por ninguno de los empleados. El horario de trabajo de las tiendas es de 7:00 a 23:00. 20 | 21 | Por ejemplo, dado que en la Tienda de Florida y Cordoba trabajan Ana Perez y Martin Gonzalez, y que la semana del 15/7/2019 tiene la siguiente asignación de horarios: 22 | - Ana Perez: Lunes de 8 a 23 hrs., Martes de 7 a 23 hrs., Miércoles de 7 a 23 hrs, Jueves de 7 a 23 hrs, Viernes de 7 a 23 hrs, Sábado de 7 a 23 hrs, Domingo de 7 a 22 hrs. 23 | - Martin Gonzalez: Lunes a Miércoles de 8 a 16 hrs. 24 | Si se consulta por los horarios no cubiertos en la semana del 15/7/2019 debería devolver la colección: { 15/7/2019 at: 7:00. 21/7/2019 at: 22 } 25 | (La revisión de horas debe hacerse cada 1 hora, o sea a las 7:00, 8:00, 9:00 y así hasta las 22:00) 26 | 27 | Implementar el modelo que satisfaga estas necesidades usando TDD. 28 | 29 | Condiciones a tener en cuenta que no es necesario testear: 30 | 1) La semana se determina por la fecha de inicio, que siempre será un lunes (por eso en los ejemplo se usa 15/7/2019 y 22/7/2019 que son lunes). 31 | 2) Lo horarios de inicio y fin de trabajo siempre deben serán una hora en punto, por lo tanto una hora de inicio de 8:30 es inválida lo mismo que una hora de fin de 16:01. 32 | 3) El horario de trabajo estará comprendida entre las 7:00 am y las 23:00 pm. 33 | 4) No habra solapamiento de horarios de trabajo 34 | -------------------------------------------------------------------------------- /2019-1c/Recuperatorio-Enunciado.txt: -------------------------------------------------------------------------------- 1 | Video de resolucion: https://www.youtube.com/watch?v=up_JqgZjDg8 2 | (El video fue hecho con un enunciado mas complejo pero que simplifique durante la realizacion del mismo) 3 | 4 | Debemos desarrollar el sistema de asignación de horarios de trabajo de los empleados de las tiendas de una empresa de comida rápida. 5 | El sistema debe permitir que los empleados asignen a su planilla de horarios de trabajo, la disponibilidad que tienen para trabajar por semana de la siguiente manera: 6 | 1) De un día de semana a otro, en cierta franja horaria. Por ejemplo: 7 | - Para la semana del 15/7/2019, de Lunes a Viernes, de 8 a 16 hrs. 8 | - Para la semana del 22/7/2019, de Jueves a Domingo, de 13 a 22 hrs. 9 | 2) Por días puntuales de la semana, en cierta franja horaria. Por ejemplo: 10 | - Para la semana del 15/7/2019, Lunes de 8 a 16 hrs, Martes de 10 a 18 hrs, Miércoles de 13 a 22 hrs, etc. 11 | 12 | El objetivo principal de la planilla de horario de trabajo de un empleado es la de responder si dicho empleado trabaja o no en cierta fecha y hora. Para el ejemplo 1), se espera los siguientes resultado: 13 | - Trabaja el 15/7/2019 a las 7:59:59? -> No 14 | - Trabaja el 15/7/2019 a las 8:00? -> Si 15 | - Trabaja el 15/7/2019 a las 9:30? -> Si 16 | - Trabaja el 15/7/2019 a las 16:00? -> No 17 | Nótese que el horario de trabajo excluye la última hora. 18 | 19 | Cada tienda conoce las planilla de trabajo de los empleados que trabajan en ella y esto es usado para que el gerente de la tienda pueda conocer en una semana particular, qué horarios no están cubiertos por ninguno de los empleados. El horario de trabajo de las tiendas es de 7:00 a 23:00. 20 | 21 | Por ejemplo, dado que en la Tienda de Florida y Cordoba trabajan Ana Perez y Martin Gonzalez, y que la semana del 15/7/2019 tiene la siguiente asignación de horarios: 22 | - Ana Perez: Lunes de 8 a 23 hrs., Martes de 7 a 23 hrs., Miércoles de 7 a 23 hrs, Jueves de 7 a 23 hrs, Viernes de 7 a 23 hrs, Sábado de 7 a 23 hrs, Domingo de 7 a 22 hrs. 23 | - Martin Gonzalez: Lunes a Miércoles de 8 a 16 hrs. 24 | Si se consulta por los horarios no cubiertos en la semana del 15/7/2019 debería devolver la colección: { 15/7/2019 at: 7:00. 21/7/2019 at: 22 } 25 | (La revisión de horas debe hacerse cada 1 hora, o sea a las 7:00, 8:00, 9:00 y así hasta las 22:00) 26 | 27 | Implementar el modelo que satisfaga estas necesidades usando TDD. 28 | 29 | Condiciones a tener en cuenta que no es necesario testear: 30 | 1) La semana se determina por la fecha de inicio, que siempre será un lunes (por eso en los ejemplo se usa 15/7/2019 y 22/7/2019 que son lunes). 31 | 2) Lo horarios de inicio y fin de trabajo siempre deben serán una hora en punto, por lo tanto una hora de inicio de 8:30 es inválida lo mismo que una hora de fin de 16:01. 32 | 3) El horario de trabajo estará comprendida entre las 7:00 am y las 23:00 pm. 33 | 4) No habra solapamiento de horarios de trabajo 34 | -------------------------------------------------------------------------------- /2019-2c/1erParcial/Enunciado.txt: -------------------------------------------------------------------------------- 1 | Enunciado: 2 | 3 | Una cadena muy importante de café llamado "Ada's Coffee Shop" tiene un sistema para premiar a sus más leales clientes en base a los productos que compra y el tipo de cliente que es. 4 | El sistema fue hecho por otra persona y ahora vos tenés que mantenerlo. Por suerte tiene varios tests, sin embargo antes de irse, el programador que lo hizo dijo que hay un poco de código repetido y algunos if que estaría bueno sacar. 5 | 6 | Respecto del negocio de Ada's Coffee Shop, hay que tener en cuenta que: 7 | 1) Hay dos tipos de productos: 8 | a) Combo 1: Cuesta 150 pesos y el cafe es de 250 mililitros 9 | b) Combo 2: Cuesta 120 pesos y el cafe es de 100 mililitros 10 | 2) Hay tres tipos de clientes: Gold, Silver y Normal. 11 | 3) Una vez por mes se decide premiar a los clientes en base a la cantidad de cafe comprado de acuerdo a las siguientes dos reglas: 12 | a) Si consumió entre 300 y 500 mililitros inclusive, el premio (reward) es un Combo2 con un precio que depende del tipo de cliente. 13 | 14 | b) Si consumió más de 500 mililitros, el premio (reward) es un Combo1 donde también el precio depende del tipo de cliente. 15 | Se puede ver en la implementaciones del mensaje #createRewardFor: cómo se decide ese precio. 16 | 17 | Luego de analizar un poco el modelo, te das cuenta que: 18 | 1) Hay código repetido en el test 2 y 3. 19 | 2) También hay código repetido en los últimos 6 tests 20 | 3) Hay varios ifs que se pueden reemplazar por polimorfismo. 21 | 22 | Tu misión es llevar adelante las mejoras nombradas en los 3 puntos anteriores. 23 | Suerte! 24 | 25 | ---- 26 | 27 | Por favor antes de empezar el parcial leer las siguientes consignas fundamentales para la entrega: 28 | 29 | 30 | 1) El parcial se debe entregar por mail 31 | 32 | 2) El mail debe ir dirigido a la lista de Docentes (ingsoft1-doc@dc.uba.ar) 33 | 34 | 3) El subject del mail debe ser: "LU: nn/nn - Solucion Primer Parcial 2c2019" ¡POR FAVOR NO SE EQUIVOQUEN EN ESTO! ES FUNDAMENTAL PARA SABER QUE RECIBIMOS SU RESOLUCIÓN 35 | 36 | 4) El mail debe contener adjunto: 37 | 38 | a) El fileout de la solución que hicieron. Recuerden de probar que el fileout carga correctamente en una imagen sin la solución. Errores de carga pueden llevar a que no podamos corregir el parcial. 39 | 40 | b) El archivo CuisUniversity-nnnn.user.changes 41 | 42 | 5) El nombre del archivo del fileout debe ser el propuesto por Cuis, o sea, el nombre de la categoría de clases. 43 | 44 | 6) No se pueden ir hasta que un docente les confirme que se recibió el mail con la solución 45 | 46 | 7) El parcial es hasta las 21:30hs, los mails recibidos luego de esa hora no serán tenidos en cuenta y se asumirá que no se realizó la entrega. 47 | 48 | 8) Recordar grabar la imagen cada cierto tiempo, hacer file out de la solución cada cierto tiempo, etc. No se aceptarán explicaciones de “la máquina se colgó" o "perdí todo" como motivos de no entrega. 49 | 50 | 9) Asegurarse de tener espacio en disco suficiente para trabajar. Si la máquina se queda sin espacio, Cuis no guardará los cambios a partir de ese momento y por lo tanto se perderá el código que escriban. 51 | -------------------------------------------------------------------------------- /2019-1c/2doParcial-Enunciado-ConMasFuncionalidad.txt: -------------------------------------------------------------------------------- 1 | Este enunciado tiene más funcionalidad que lo que se tomo finalmente, pero sirve si desean practicar más. 2 | ---- 3 | Hemos detectado una oportunidad de negocio que tiene que ver con administrar el calendario de personas y de grupos de personas, ya que las soluciones que existen actualmente son muy limitadas. 4 | El objetivo es poder crear calendarios para cada persona de una empresa y luego poder agruparlos de acuerdo a los grupos de trabajo de una empresa. 5 | Por ejemplo, si en la empresa trabajan Juan Perez y Pepe Sanchez, cada uno tendrá su calendario, y como ambos forman parte del equipo de desarrollo también habrá un calendario del "Equipo de Desarrollo" que incluirá los calendarios de Juan Perez y Pepe Sanchez. Como el equipo de desarrollo forma parte del grupo de IT de la empresa, dicho calendario formará parte del calendario del grupo de IT junto al del equipo de QA y PMs (entre otros). Todos formarán parte del calendario grupal de la empresa (donde además está el calendario del CEO). 6 | Por suerte las empresas clientes que tenemos poseen una organización jerárquica perfecta por lo que no hay que preocuparse en esta versión sobre la organización de los calendarios. 7 | Lo que se dese a nivel funcional de los calendarios poder crear eventos para luego buscar espacios libres fácilmente ya sea en el calendario de una persona o de un grupo. 8 | Todos los eventos tienen una hora de inicio y fin en cierto día, y algunos se pueden repetir a lo largo del tiempo. 9 | Los eventos que vamos a soportar por ahora son: 10 | 1) Eventos puntuales que no se repiten. Ejemplo: De 10:00 a 11:00 el 1/1/2019 11 | 2) Eventos que se repiten cada cierta medida de tiempo. Ejemplos: 12 | a) De 10:00 a 11:30 el 2/2/2019 que se repite cada 1 semana hasta el 3/3/2019 13 | b) De 11:00 a 11:30 el 3/5/2019 que se repite cada 3 días haste el fin de los tiempos (o sea, no tiene fecha de finalización) 14 | c) De 9:50 a 11:30 el 28/10/2019 que se repite cada 1 año hasta el 2/2/2030. 15 | etc. La medida de tiempo puede ser de cualquier unidad de tiempo mayor o igual a 1 día (dia, semana, mes, año, etc). 16 | 3) Eventos que se repiten ciertos días de la semana. Ejemplos: 17 | a) De 9:00 a 12:00 el 1/1/2019 hasta el 1/3/2019 que se repite los Martes y Jueves. 18 | b) De 17:00 a 22:00 el 18/3/2019 hasta el 6/6/2019 que se repite los Lunes y Jueves (horario de la materia Ingeniería de Software!) 19 | Los eventos se deben poder agregar en los calendarios personales o grupales. Cuando se agrega un evento en un calendario grupal, el mismo debe ser impactado en los calendarios que lo forman. 20 | Los calendarios deben servir para saber si un lugar en ellos está disponible. Por ejemplo, si el calendario de Juan Perez tiene un evento de 9 a 10 hrs el día 4/7/2019 y se le pregunta si hay lugar disponible entre las 8:30 y 9:30 del 4/7/2019, debería decir que no. Mientras que si se le pregunta si hay lugar entre las 10:00 y 11:00 ese mismo día debería decir que sí. 21 | Una funcionalidad muy importante que debemos ofrecer de los calendarios, tanto grupales como individuales, es la de poder buscar el primer lugar disponible para crear un evento. Estas búsquedas deben siempre indicar el rango de hora que se desea buscar, de que duración es el lugar a buscar, con que incremento de minutos de búsqueda y en qué rango de fecha evitando ciertos días de semana. Por ejemplo: 22 | a) Entre las 9 y las 12 hrs, de 1 hr. de duración, buscando cada 15 minutos, desde 1/1/2019 hasta el 7/1/2019, salvo Sábados y Domingos. 23 | b) Entre las 15 y las 17 hrs, de 30 minutos de duración, cada 30 minutos, entre el 10/3/2019 y el 20/3/2019, salvo Lunes y Miércoles. 24 | Implementar el modelo que satisfaga estas necesidades usando TDD. 25 | -------------------------------------------------------------------------------- /2019-1c/Recuperatorio-Enunciado-ConMasFuncionalidad.txt: -------------------------------------------------------------------------------- 1 | Este enunciado tiene más funcionalidad que lo que se tomo finalmente, pero sirve si desean practicar más. 2 | ---- 3 | Debemos desarrollar el sistema de asignación de horarios de trabajo de los empleados de las tiendas de una empresa de comida rápida. 4 | El sistema debe permitir que los empleados asignen a su planilla de horarios de trabajo, la disponibilidad que tienen para trabajar por semana de la siguiente manera: 5 | 1) De un día de semana a otro, en cierta franja horaria. Por ejemplo: 6 | - Para la semana del 15/7/2019, de Lunes a Viernes, de 8 a 16 hrs. 7 | - Para la semana del 22/7/2019, de Jueves a Domingo, de 13 a 22 hrs. 8 | 2) Por días puntuales de la semana, en cierta franja horaria. Por ejemplo: 9 | - Para la semana del 15/7/2019, Lunes de 8 a 16 hrs, Martes de 10 a 18 hrs, Miércoles de 13 a 22 hrs, etc. 10 | 11 | La semana se determina por la fecha de inicio, que siempre debe ser un lunes (por eso en los ejemplo se usa 15/7/2019 y 22/7/2019 que son lunes). 12 | Lo horarios de inicio y fin de trabajo siempre deben ser al inicio de una hora, por lo tanto una hora de inicio de 8:30 es inválida lo mismo que una hora de fin de 16:01. 13 | El horario de trabajo debe estar comprendida entre las 7:00 am y las 23:00 pm. 14 | 15 | El objetivo principal de la planilla de horario de trabajo de un empleado es la de responder si dicho empleado trabaja o no en cierta fecha y hora. Para el ejemplo 1), se espera los siguientes resultado: 16 | - Trabaja el 15/7/2019 a las 7:59:59? -> No 17 | - Trabaja el 15/7/2019 a las 8:00? -> Si 18 | - Trabaja el 15/7/2019 a las 9:30? -> Si 19 | - Trabaja el 15/7/2019 a las 16:00? -> No 20 | Nótese que el horario de trabajo excluye la última hora. 21 | 22 | Cada tienda conoce las planilla de trabajo de los empleados que trabajan en ella y esto es usado para que el gerente de la tienda pueda: 23 | 1) Conocer en una semana particular, qué horarios no están cubiertos por ninguno de los empleados. 24 | 2) Conocer en una semana particular, que empleados trabajan menos de 40 horas. 25 | 26 | Por ejemplo, dado que en la Tienda de Florida y Cordoba trabajan Ana Perez y Martin Gonzalez, y que la semana del 15/7/2019 tiene la siguiente asignación de horarios: 27 | - Ana Perez: Lunes de 8 a 23 hrs., Martes de 7 a 23 hrs., Miércoles de 7 a 23 hrs, Jueves de 7 a 23 hrs, Viernes de 7 a 23 hrs, Sábado de 7 a 23 hrs, Domingo de 7 a 22 hrs. 28 | - Martin Gonzalez: Lunes a Miércoles de 8 a 16 hrs. 29 | 1) Si se consulta por los horarios no cubiertos en la semana del 15/7/2019 debería devolver la colección: { 15/7/2019 at: 7:00. 21/7/2019 at: 22 } 30 | (La revisión de horas debe hacerse cada 1 hora, o sea a las 7:00, 8:00, 9:00 y así hasta las 22:00) 31 | 2) Si se consulta por los que trabajan menos de 40 hrs. en la semana del 15/7/2019 debería devolver una colección que solo contenga a Martin Gonzalez 32 | 33 | Implementar el modelo que satisfaga estas necesidades usando TDD. 34 | 35 | Ayudas: 36 | 1) July/15/2019 crea la fecha 15 de Julio de 2019 37 | 2) 10:59:58 crea la hora 10 minuto 59, segundo 59 38 | 3) July/15/2019 at: 10:00 crea el día/hora del 15 de Julio de 2019 a las 10:00 39 | 4) July/15/2019 previous devuelve July/14/2019. 40 | 5) July/15/2019 next: 6*day devuelve July/21/2019 41 | 6) July/15/2019 nextDay: Sunday devuelve July/21/2019 42 | 7) (July/15/2019 at: 10:00) timeOfDay devuelve 10:00 43 | 8) (10:30:59) minutes devuelve 30*minute 44 | 9) (10:30:59) seconds devuelve 59*second 45 | 10) (10:30:59) timeFromMidnight devuelve una medida de tiempo desde las 0 horas 46 | 10) ((10:30:59) timeFromMidnight convertTo: hour) isAmountInteger devuelve false 47 | 11) July/15/2019 to: (July/15/2019 next: 6*day) devuelve un intervalo que incluye todas las fechas del 15 de Julio de 2019 al 21 de Julio de 2019, o sea las fechas de la semana del 15 de Julio de 2019. 48 | -------------------------------------------------------------------------------- /2020-1c/1erParcial/ISW1-2020-1C-Parcial-Enunciado.md: -------------------------------------------------------------------------------- 1 | # I, Robot 2 | 3 | ## HWS 4 | 5 | HWS es una empresa de envíos de productos que quiere automatizar totalmente sus almacenes utilizando robots para armar los pedidos que luego se enviaran a los clientes. 6 | 7 | Esta primera etapa del proyecto tiene como objetivo un modelo computable con las siguientes características: 8 | 9 | ## Productos 10 | 11 | - Solo existen 2 tipos de producto: ProductoA y ProductoB (ésto es una simplificación de la vida real pero que sirve en esta primer instancia). 12 | 13 | - Cada producto tiene un peso y altura asociados. Dos productos del mismo tipo no necesariamente tienen el mismo peso o altura. 14 | 15 | ## Los Robots 16 | 17 | Los robots van circulando por los pasillos del almacén juntando los productos que tienen en su lista. Gracias a los sensores que tienen (GPS, cámaras, etc.) pueden ir tomando los productos que necesitan utilizando su brazo mecánico. 18 | 19 | Para el modelo que estamos implementando necesitamos saber que: 20 | 21 | ### Estados del robot 22 | 23 | - Los robots pueden estar en 4 estados (que afectan su funcionamiento): 24 | - Working Normal: Trabaja normalmente y no presenta ninguna falla. 25 | - Sensors Failure: Algún sensor interno presenta problemas. 26 | - Mechanical Failure: Algún componente mecánico presenta problemas. 27 | - Out of order: El robot está fuera de servicio y no puede realizar ningún trabajo. 28 | 29 | ### Tomar productos 30 | 31 | - Cada robot cuenta con un trailer donde coloca los productos. 32 | 33 | - **Puede tomar productos** en los siguiente estados: 34 | - Working Normal 35 | - Sensors Failure 36 | - Mechanical Failure 37 | 38 | - Pero **no puede tomar productos** si está Out of order 39 | 40 | ### Cerrar orden de compra 41 | 42 | - Cuando un robot termina la compra se le asigna un cajero automático (**cashier**) para cerrar la orden de compra. 43 | 44 | - **Puede cerrar una compra** en los siguientes estados: 45 | - Working Normal 46 | - Mechanical Failure 47 | 48 | - Pero **no puede cerrar una compra** en los siguientes estados: 49 | - Sensors Failure 50 | - Out of order. 51 | 52 | ## Cashier 53 | 54 | - Recibe al robot y según el estado del mismo acepta o no los productos. Además de marcar al robot como "out of order" en caso de presentar fallas mecánicas. Ver la clase **Cashier** para más detalles de implementación. 55 | 56 | ## Trailers 57 | 58 | Los trailers pueden llevar un peso y altura máximos (ambos configurables). 59 | 60 | - Los productos A no se pueden apilar con lo cual no nos preocupa la altura a la hora de agregar un producto A (solo importa que no exceda el peso máximo del trailer) 61 | 62 | - Con respecto a llevar Productos B, éstos son apilables (y solo se pueden llevar apilados!), por lo tanto además de interesarnos no exceder el límite de peso también importa que no excedan el máximo de altura que puede llevar el trailer. (Notar que solo importa no exceder el límite de altura **solo con los productos apilables**) 63 | 64 | # Trabajo a Realizar: 65 | 66 | 1. Las implementaciones de `Robot` y `Cashier` no deben tener `ifs` cuando los mismos pueden ser reemplazados por polimorfismo. 67 | 2. Sacar el código repetido de las clases `Robot`, `Cashier` y `Trailer`. 68 | 3. Sacar el código repetido de los `test01`, `test02`, `test03` y `test04` de `Cashier`. 69 | 4. Mejorar los tests de `Trailer`: 70 | - mejores nombres. 71 | - sacar código repetido. 72 | 73 | Usar las heurísticas de diseño vistas hasta ahora (buenos nombres, métodos cortos y categorizados, etc.) 74 | 75 | **NOTA:** Los ítems 1. y 2. deben realizarse sin modificar los tests. En los items 3. y 4. no se debe modificar la funcionalidad del modelo que se testea. 76 | 77 | Entrega: 78 | 1.- Entregar el fileout de la categoría de clase `ISW1-2020-1C-Parcial` que debe incluir toda la solución (modelo y tests). El archivo de fileout se debe llamar: `ISW1-2020-1C-Parcial.st` 79 | 2.- Entregar también el archivo que se llama `CuisUniversity-nnnn.user.changes` 80 | 3.- Probar que el archivo generado en 1) se cargue correctamente en una imagen “limpia” (o sea, sin la solución que crearon) y que todo funcione correctamente. Esto es fundamental para que no haya problemas de que falten clases/métodos/objetos en la entrega. 81 | 4.- Realizar la entrega enviando mail a la lista de Docentes: ingsoft1-doc@dc.uba.ar con el **Subject:** LU nnn/aa - Solucion 1er parcial 1c2020 82 | 83 | **IMPORTANTE:** Al enviar la solución del parcial deben recibir una confirmación de recepción. 84 | -------------------------------------------------------------------------------- /2019-1c/2doParcial-Enunciado.txt: -------------------------------------------------------------------------------- 1 | Resolucion: https://www.youtube.com/watch?v=iny2nT3Q8fc 2 | 3 | Enunciado: 4 | Hemos detectado una oportunidad de negocio que tiene que ver con administrar el calendario de personas y de grupos de personas, ya que las soluciones que existen actualmente son muy limitadas. 5 | El objetivo es poder crear calendarios para cada persona de una empresa y luego poder agruparlos de acuerdo a los grupos de trabajo de una empresa. 6 | Por ejemplo, si en la empresa trabajan Ana Perez y Pepe Sanchez, cada uno tendrá su calendario, y como ambos forman parte del equipo de desarrollo también habrá un calendario del "Equipo de Desarrollo" que incluirá los calendarios de Ana Perez y Pepe Sanchez. Si más tarde se suma al grupo María Fernandez, se debe poder agregar su calendario al del equipo de desarrollo. 7 | Como el equipo de desarrollo forma parte del grupo de IT de la empresa, dicho calendario formará parte del calendario del grupo de IT junto al del equipo de QA y PMs (y todos los otros grupos que existan de IT o que se creen posteriormente). Todos formarán parte del calendario grupal de la empresa (donde además está el calendario del CEO). 8 | Por suerte las empresas clientes que tenemos poseen una organización jerárquica perfecta, por lo que no hay que preocuparse en esta versión que haya calendarios repetidos o una jerarquía mal formada. 9 | Lo que se desea a nivel funcional de los calendarios es poder agregar eventos en ellos para luego buscar espacios libres fácilmente, ya sea en el calendario de una persona o de un grupo. 10 | 11 | Todos los eventos tienen una hora de inicio y fin en cierto día, y algunos se pueden repetir a lo largo del tiempo. 12 | Los eventos que vamos a soportar por ahora son: 13 | 1) Eventos puntuales que no se repiten. Ejemplo: De 10:00 a 11:00 el 1/1/2019 14 | 2) Eventos que se repiten cada cierta medida de tiempo. Ejemplos: 15 | a) De 10:00 a 11:30 el 2/2/2019 que se repite cada 1 semana hasta el 3/3/2019 16 | b) De 11:00 a 11:30 el 3/5/2019 que se repite cada 3 días haste el fin de los tiempos (o sea, no tiene fecha de finalización) 17 | c) De 9:50 a 11:30 el 28/10/2019 que se repite cada 1 año hasta el 2/2/2030. 18 | La medida de tiempo puede ser de cualquier unidad de tiempo mayor o igual a 1 día (dia, semana, mes, año, etc). 19 | 20 | Los eventos se deben poder agregar en los calendarios personales o grupales. Cuando se agrega un evento en un calendario grupal, el mismo debe ser impactado en los calendarios que lo forman. 21 | 22 | Los calendarios deben servir para saber si un lugar en ellos está disponible. Por ejemplo, si el calendario de Ana Perez tiene un evento de 9 a 10 hrs el día 4/7/2019 y se le pregunta si hay lugar disponible entre las 8:30 y 9:30 del 4/7/2019, debería decir que no. Mientras que si se le pregunta si hay lugar entre las 10:00 y 11:00 ese mismo día debería decir que sí. 23 | 24 | Una funcionalidad muy importante que debemos ofrecer de los calendarios, tanto grupales como individuales, es la de poder buscar el primer lugar disponible para crear un evento. Estas búsquedas deben siempre indicar el rango de hora en que se desea buscar el espacio, de qué duración es el lugar a buscar y en qué rango de fechas. Por ejemplo: 25 | a) Entre las 9 y las 12 hrs, de 1 hr. de duración, desde 1/1/2019 hasta el 7/1/2019 26 | b) Entre las 15 y las 17 hrs, de 30 minutos de duración, entre el 10/3/2019 y el 20/3/2019 27 | Siempre incrementa el tiempo de la búsqueda en intervalos de 1 hora. O sea, para el ejemplo b), si no hay lugar el 10/3/2019 a las 17 hrs deberá buscar como siguiente lugar posible el 10/3/2019 a las 16 hrs y así hasta las 17 hrs de ese día. Si no hay lugar ese día debe pasar al siguiente (11/3/2019) empezando a buscar a las 15 hrs. 28 | 29 | Implementar el modelo que satisfaga estas necesidades usando TDD. 30 | 31 | Ayudas: 32 | 1) January/10/2019 crea la fecha 10 de Enero de 2019 33 | 2) 10:00 crea la hora 10:00 34 | 3) January/10/2019 at: 10:00 crea el día/hora del 10 de Enero de 2019 a las 10:00 35 | 4) (January/10/2019 at: 10:00) to: (January/10/2019 at: 11:00) crea un intervalo de tiempo que va desde el 10 de Enero de 2019 a las 10:00 a las 11:00 del mismo día. De la misma manera se puede crear intervalos solo de fechas como January/10/2019 to: January/11/2019 o de horas 10:00 to: 15:30. 36 | 5) Los día se semana son Sunday (para domingo), Monday (para lunes), etc. 37 | 6) Se pueden crear medidas de tiempo multiplicando una cantidad por su unidad, por ejemplo: 1*hour o 10*day o 5*week, etc. 38 | 7) January/10/2019 to: January/15/2019 by: 2*day crea un intervalo de fechas que va desde el 10 al 15 de Enero cada 2 dias, o sea que incluye el 10, 12 y 14 de Enero. 39 | 8) January/10/2019 to: FixedGregorianDate theEndOfTime crea un intervalo de fecha que empieza el 10 de Enero de 2019 y no termina. 40 | -------------------------------------------------------------------------------- /2019/2doParcial-Enunciado.txt: -------------------------------------------------------------------------------- 1 | Resolucion: https://www.youtube.com/watch?v=iny2nT3Q8fc 2 | 3 | Enunciado: 4 | Hemos detectado una oportunidad de negocio que tiene que ver con administrar el calendario de personas y de grupos de personas, ya que las soluciones que existen actualmente son muy limitadas. 5 | El objetivo es poder crear calendarios para cada persona de una empresa y luego poder agruparlos de acuerdo a los grupos de trabajo de una empresa. 6 | Por ejemplo, si en la empresa trabajan Ana Perez y Pepe Sanchez, cada uno tendrá su calendario, y como ambos forman parte del equipo de desarrollo también habrá un calendario del "Equipo de Desarrollo" que incluirá los calendarios de Ana Perez y Pepe Sanchez. Si más tarde se suma al grupo María Fernandez, se debe poder agregar su calendario al del equipo de desarrollo. 7 | Como el equipo de desarrollo forma parte del grupo de IT de la empresa, dicho calendario formará parte del calendario del grupo de IT junto al del equipo de QA y PMs (y todos los otros grupos que existan de IT o que se creen posteriormente). Todos formarán parte del calendario grupal de la empresa (donde además está el calendario del CEO). 8 | Por suerte las empresas clientes que tenemos poseen una organización jerárquica perfecta, por lo que no hay que preocuparse en esta versión que haya calendarios repetidos o una jerarquía mal formada. 9 | Lo que se desea a nivel funcional de los calendarios es poder agregar eventos en ellos para luego buscar espacios libres fácilmente, ya sea en el calendario de una persona o de un grupo. 10 | 11 | Todos los eventos tienen una hora de inicio y fin en cierto día, y algunos se pueden repetir a lo largo del tiempo. 12 | Los eventos que vamos a soportar por ahora son: 13 | 1) Eventos puntuales que no se repiten. Ejemplo: De 10:00 a 11:00 el 1/1/2019 14 | 2) Eventos que se repiten cada cierta medida de tiempo. Ejemplos: 15 | a) De 10:00 a 11:30 el 2/2/2019 que se repite cada 1 semana hasta el 3/3/2019 16 | b) De 11:00 a 11:30 el 3/5/2019 que se repite cada 3 días haste el fin de los tiempos (o sea, no tiene fecha de finalización) 17 | c) De 9:50 a 11:30 el 28/10/2019 que se repite cada 1 año hasta el 2/2/2030. 18 | La medida de tiempo puede ser de cualquier unidad de tiempo mayor o igual a 1 día (dia, semana, mes, año, etc). 19 | 20 | Los eventos se deben poder agregar en los calendarios personales o grupales. Cuando se agrega un evento en un calendario grupal, el mismo debe ser impactado en los calendarios que lo forman. 21 | 22 | Los calendarios deben servir para saber si un lugar en ellos está disponible. Por ejemplo, si el calendario de Ana Perez tiene un evento de 9 a 10 hrs el día 4/7/2019 y se le pregunta si hay lugar disponible entre las 8:30 y 9:30 del 4/7/2019, debería decir que no. Mientras que si se le pregunta si hay lugar entre las 10:00 y 11:00 ese mismo día debería decir que sí. 23 | 24 | Una funcionalidad muy importante que debemos ofrecer de los calendarios, tanto grupales como individuales, es la de poder buscar el primer lugar disponible para crear un evento. Estas búsquedas deben siempre indicar el rango de hora en que se desea buscar el espacio, de qué duración es el lugar a buscar y en qué rango de fechas. Por ejemplo: 25 | a) Entre las 9 y las 12 hrs, de 1 hr. de duración, desde 1/1/2019 hasta el 7/1/2019 26 | b) Entre las 15 y las 17 hrs, de 30 minutos de duración, entre el 10/3/2019 y el 20/3/2019 27 | Siempre incrementa el tiempo de la búsqueda en intervalos de 1 hora. O sea, para el ejemplo b), si no hay lugar el 10/3/2019 a las 17 hrs deberá buscar como siguiente lugar posible el 10/3/2019 a las 16 hrs y así hasta las 17 hrs de ese día. Si no hay lugar ese día debe pasar al siguiente (11/3/2019) empezando a buscar a las 15 hrs. 28 | 29 | Implementar el modelo que satisfaga estas necesidades usando TDD. 30 | 31 | Ayudas: 32 | 1) January/10/2019 crea la fecha 10 de Enero de 2019 33 | 2) 10:00 crea la hora 10:00 34 | 3) January/10/2019 at: 10:00 crea el día/hora del 10 de Enero de 2019 a las 10:00 35 | 4) (January/10/2019 at: 10:00) to: (January/10/2019 at: 11:00) crea un intervalo de tiempo que va desde el 10 de Enero de 2019 a las 10:00 a las 11:00 del mismo día. De la misma manera se puede crear intervalos solo de fechas como January/10/2019 to: January/11/2019 o de horas 10:00 to: 15:30. 36 | 5) Los día se semana son Sunday (para domingo), Monday (para lunes), etc. 37 | 6) Se pueden crear medidas de tiempo multiplicando una cantidad por su unidad, por ejemplo: 1*hour o 10*day o 5*week, etc. 38 | 7) January/10/2019 to: January/15/2019 by: 2*day crea un intervalo de fechas que va desde el 10 al 15 de Enero cada 2 dias, o sea que incluye el 10, 12 y 14 de Enero. 39 | 8) January/10/2019 to: FixedGregorianDate theEndOfTime crea un intervalo de fecha que empieza el 10 de Enero de 2019 y no termina. 40 | -------------------------------------------------------------------------------- /2019-2c/2doParcial/Enunciado.txt: -------------------------------------------------------------------------------- 1 | La NASA a decidido hacer una nueva versión del MarsRover en base a las experiencias adquiridas en la versión anterior. 2 | El motivo por el cual nos eligieron a nosotros se debe a que saben que podemos hacer una solución robusta, bien testeada, donde vamos a encontrar casos de prueba no previstos en el requerimiento y con un buen diseño. 3 | Las mejoras que se deben implementar son: 4 | 1) Para minimizar la cantidad de comandos enviados en el string de comandos, se debe poder agregar un dígito luego de un comando que indica cuantas veces, más dos, se debe repetir el último comando. 5 | Por ejemplo: 'f0' implica que hay que hacer forward 3 veces. Una vez por la primer f y dos veces por el 0. 6 | El motivo por el cual se suma 2 al dígito es para maximizar la cantidad de repeticiones, ya que enviar un 0 solo no tiene sentido, y el 1 seria equivalente a mandar dos comando iguales seguidos. 7 | La repetición debe poder ser aplicada solo para los comandos f,b,r y l y es de un solo dígito. 8 | 2) Algo que se notó de la primer versión es que a veces el MarsRover se quedaba trabado en una roca y a veces, si el piso era de hielo, se resbalaba y no frenaba en la posición indicada. Por este motivo se agregó al MarsRover un sensor de suelo que permite determinar el tipo de suelo en el que terminará al ejecutar un comando. O sea, el sensor devuelve el tipo de suelo de una posición dada. 9 | Los tipos de suelo que detecta son 3: Tierra, Hielo y Roca. 10 | - Cuando el tipo de suelo es Tierra, el movimiento de MarsRover es el normal, como funciona hasta ahora. 11 | Cuando el tipo de suelo es Roca, el MarsRover no puede rotar ni moverse a esa posición y deber informar de la situación con una excepción. Ejemplos: 12 | - Si el MarsRover está en la posición 1@2 apuntando al Norte y en la posición 1@3 hay una roca, si se le pide que procese 'f' debería levantar una excepción y quedarse en la posición 1@2 apuntando al Norte. 13 | - Si el MarsRover está en la posición 1@2 apuntando al Norte y en esa posición hay una roca, si se le pide rotar a la izquierda se debe levantar una excepción y el MarsRover quedará en la misma posición apuntando al Norte, o sea, no puede rotar. 14 | - Cuando el tipo de suelo es Hielo, el MarsRover se desliza una cantidad inesperada (random) de puntos en la dirección que iba. Ejemplos: 15 | - Si el MarsRover está en la posición 1@2 apuntando al Norte y en la posición 1@3 hay hielo, si se le pide que procese 'f' puede terminar en la posición 1@3, 1@4, 1@5... hasta 1@12 (por suerte el limite de desplazamiento en hielo es de 10 puntos) 16 | - Por suerte el hielo no afecta la rotación, o sea que rota como si estuviera en tierra. 17 | 3) Por último, para no perder la posición del MarsRover cuando hay problemas se debe implementar un estado de "movimiento seguro". 18 | El inicio de este estado se indica en la secuencia de comandos a procesar por medio del caracter "abrir paréntesis", o sea $(, y se finaliza por medio del caracter "cerrar parentesis", o sea $). 19 | Si hay algún problema con la ejecución de los comandos en estado seguro, o sea los comandos que se encuentran en parentesis, el MarsRover debe volver a su posición inicial apuntando hacia donde estaba antes de moverse de manera segura. 20 | Para volver a la posición inicial debe deshacer todos los movimientos que hizo, o sea, hacer el movimiento contrario a cada movimiento que hizo hasta que se produjo el error. En pocas palabras, hacer un undo de los movimientos. 21 | Por ejemplo.: 22 | - Si el MarsRover está en la posición 1@2 apuntando al Norte y en la posición 1@4 hay una roca, si se le pide que procese '(ff)', se debería levantar la excepción de que encontró una roca y volver a la posición 1@2 apuntando al Norte. 23 | - Si cuando se esta moviendo de manera segura llega a un tipo de piso de Hielo, también se debe levantar una excepción y volver a la posición inicial puesto el movimiento sobre hielo es impredesible 24 | - Debe suceder lo mismo si se encuentran comandos inválidos cuando se esta moviendo de manera segura. 25 | Aclaraciones: 26 | - En una misma secuencia de comandos se pueden tener varios movimientos en estado seguro. Por ejemplo: 'frf(fflb3)ff(rb)' 27 | - Cuando se esta en estado seguro, no se puede empezar otro estado seguro. Por ejemplo: 'ff(ff(rb)f)' debería levantar una excepción y volver a la posición inicial. 28 | - En toda secuencia de comandos, siempre debe terminarse la ejecución de estado seguro. Por ejemplo: 'f(ff' debería levantar una excepción ya que no terminó la secuencia de comandos en estado seguro, y debería volver a la posición que tenía al empezar el estado seguro. 29 | 30 | Desarrollar el ejercicio haciendo TDD y usando todas las heurísticas de diseño que vimos durante la cursada. 31 | 32 | Mensajes útiles: 33 | - #isDigit devuelve true si un caracter es un dígito. 34 | - #digitValue devuelve el numero entero que representa un caracter. Por ejemplo: $3 digitValue --> devuelve 3 35 | - #nextInteger: aLimit cuando se lo enviamos a una instancia de Random, devuelve un numero entero random entre 1 y aLimit. 36 | - #* aNumber: Se le puede enviar a un numero para multiplicarlo por aNumber 37 | - #pass: Cuando se lo envia a una excepcion, pasa la excepcion al siguiente handler 38 | ------------ 39 | Por favor antes de empezar el parcial leer las siguientes consignas fundamentales para la entrega: 40 | 41 | 42 | 1) El parcial se debe entregar por mail 43 | 44 | 2) El mail debe ir dirigido a la lista de Docentes (ingsoft1-doc@dc.uba.ar) 45 | 46 | 3) El subject del mail debe ser: "LU: nn/nn - Solucion Segundo Parcial 2c2019" 47 | 48 | ¡POR FAVOR NO SE EQUIVOQUEN EN ESTO! ES FUNDAMENTAL PARA SABER QUE RECIBIMOS SU RESOLUCIÓN 49 | 50 | 4) El mail debe contener adjunto: 51 | 52 | a) El fileout de la solución que hicieron. Recuerden de probar que el fileout carga correctamente en una imagen sin la solución. Errores de carga pueden llevar a que no podamos corregir el parcial. 53 | 54 | b) El archivo CuisUniversity-nnnn.user.changes 55 | 56 | 5) El nombre del archivo del fileout debe ser el propuesto por Cuis, o sea, el nombre de la categoría de clases. 57 | 58 | 6) No se pueden ir hasta que un docente les confirme que se recibió el mail con la solución 59 | 60 | 7) El parcial es hasta las 21:30hs, los mails recibidos luego de esa hora no serán tenidos en cuenta y se asumirá que no se realizó la entrega. 61 | 62 | 8) Recordar grabar la imagen cada cierto tiempo, hacer file out de la solución cada cierto tiempo, etc. No se aceptarán explicaciones de “la máquina se colgó" o "perdí todo" como motivos de no entrega. 63 | 64 | 9) Asegurarse de tener espacio en disco suficiente para trabajar. Si la máquina se queda sin espacio, Cuis no guardará los cambios a partir de ese momento y por lo tanto se perderá el código que escriban. 65 | -------------------------------------------------------------------------------- /2024-2c/1erParcial/2024-2C-Parcial-1.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #TestMyA category: #'2024-2C-Parcial-1'! 2 | TestCase subclass: #TestMyA 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: '2024-2C-Parcial-1'! 7 | 8 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 03:49:05'! 9 | test01UnMonstruoAtacaAUnAventureroUsandoSusPVs 10 | 11 | | guerrero | 12 | 13 | guerrero := self crearGuerrero. 14 | 15 | self crearGoblin atacarA: guerrero. 16 | 17 | self assert: (guerrero tienePuntosDeVida: 10 * pv - (5 * pv))! ! 18 | 19 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:09:06'! 20 | test02UnAventureroPuedeUsarItemsDeDefensaParaProtegerse 21 | 22 | | guerrero | 23 | 24 | guerrero := self crearGuerrero. 25 | guerrero equiparItemDeDefensa: self crearEscudoMagico. 26 | guerrero equiparItemDeDefensa: self crearArmadura. 27 | 28 | self crearOgro atacarA: guerrero. 29 | 30 | self assert: (guerrero tienePuntosDeVida: 10 * pv - (15 * pv - (5 * pv) - (3 * pv)))! ! 31 | 32 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:08:35'! 33 | test03LosItemsDeDefensaNoPuedenAumentarLosPuntosDeVidaDelAventurero 34 | 35 | | guerrero | 36 | 37 | guerrero := self crearGuerrero. 38 | guerrero equiparItemDeDefensa: self crearArmadura. 39 | guerrero equiparItemDeDefensa: self crearArmadura. 40 | 41 | self crearGoblin atacarA: guerrero. 42 | 43 | self assert: (guerrero tienePuntosDeVida: 10 * pv)! ! 44 | 45 | !TestMyA methodsFor: 'tests' stamp: 'HAW 9/27/2024 09:04:39'! 46 | test04UnAventureroNoPuedeAtacarSinItemsEquipados 47 | 48 | | guerrero ogro espada | 49 | 50 | guerrero := self crearGuerrero. 51 | ogro := self crearOgro. 52 | espada := self crearEspadaPara: ogro. 53 | 54 | self should: [ guerrero atacarA: ogro con: (espada) ] 55 | raise: Error-MessageNotUnderstood 56 | withExceptionDo: [ :anException | 57 | self assert: anException messageText equals: guerrero itemNoDisponibleMensajeDeError. 58 | self assert: (ogro tienePuntosDeVida: 15 * pv) 59 | ] 60 | ! ! 61 | 62 | !TestMyA methodsFor: 'tests' stamp: 'LL 9/27/2024 10:48:15'! 63 | test05UnGuerreroConEspadaProvocaDañoSegunSuFuerza 64 | 65 | | guerrero ogro itemDeAtaque otroItemDeAtaque otroOgro | 66 | 67 | guerrero := self crearGuerrero. 68 | ogro := self crearOgro. 69 | itemDeAtaque := self crearEspadaPara: ogro. 70 | guerrero equiparItemDeAtaque: itemDeAtaque. 71 | otroOgro := self crearOgro. 72 | otroItemDeAtaque := self crearEspadaPara: otroOgro. 73 | guerrero equiparItemDeAtaque: otroItemDeAtaque. 74 | 75 | guerrero atacarA: ogro con: itemDeAtaque. 76 | guerrero atacarA: otroOgro con: otroItemDeAtaque. 77 | 78 | self assert: (ogro tienePuntosDeVida: 15 * pv - (4 * pv)). 79 | self assert: (otroOgro tienePuntosDeVida: 15 * pv - (4 * pv)). 80 | self assert: (guerrero tienePuntosDeVida: 10 * pv)! ! 81 | 82 | !TestMyA methodsFor: 'tests' stamp: 'HAW 9/27/2024 09:46:06'! 83 | test06UnGuerreroConEspadaNoProvocaDañoAOtroMonstruoQueNoSeaElDeLaEspada 84 | 85 | | guerrero ogroNoObjetivoDeAtaque itemDeAtaque ogroObjetivoDeAtaque | 86 | 87 | guerrero := self crearGuerrero. 88 | ogroObjetivoDeAtaque := self crearOgro. 89 | itemDeAtaque := self crearEspadaPara: ogroObjetivoDeAtaque. 90 | guerrero equiparItemDeAtaque: itemDeAtaque. 91 | ogroNoObjetivoDeAtaque := self crearOgro. 92 | 93 | guerrero atacarA: ogroNoObjetivoDeAtaque con: itemDeAtaque. 94 | 95 | self assert: (ogroNoObjetivoDeAtaque tienePuntosDeVida: 15 * pv)! ! 96 | 97 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:08:52'! 98 | test07UnAventureroNoGuerreroPierdeTodosSusPuntosDeVidaSiUsaLaEspada 99 | 100 | | ogro mago itemDeAtaque | 101 | 102 | mago := self crearMago. 103 | ogro := self crearOgro. 104 | itemDeAtaque := self crearEspadaPara: ogro. 105 | mago equiparItemDeAtaque: itemDeAtaque. 106 | 107 | mago atacarA: ogro con: itemDeAtaque. 108 | 109 | self assert: (ogro tienePuntosDeVida: 15 * pv). 110 | self assert: (mago tienePuntosDeVida: 0)! ! 111 | 112 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:08:49'! 113 | test08ElMagoUsandoElBaculoMataAlGoblin 114 | 115 | | mago goblin itemDeAtaque | 116 | 117 | mago := self crearMago. 118 | itemDeAtaque := self crearBaculo. 119 | mago equiparItemDeAtaque: itemDeAtaque. 120 | goblin := self crearGoblin. 121 | 122 | mago atacarA: goblin con: itemDeAtaque. 123 | 124 | self assert: (goblin tienePuntosDeVida: 0)! ! 125 | 126 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:42:13'! 127 | test09ElMagoUsandoElBaculoDañaAOtrosMonstruosSegunSuFuerza 128 | 129 | | mago ogro itemDeAtaque | 130 | 131 | mago := self crearMago. 132 | itemDeAtaque := self crearBaculo. 133 | mago equiparItemDeAtaque: itemDeAtaque. 134 | ogro := self crearOgro. 135 | 136 | mago atacarA: ogro con: itemDeAtaque. 137 | 138 | self assert: (ogro tienePuntosDeVida: 15 * pv - (2 * pv))! ! 139 | 140 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:08:45'! 141 | test10UnAventureroNoMagoEsPenalizadoAlUsarElBaculoDuplicandoPVDeGoblins 142 | 143 | | guerrero goblin itemDeAtaque | 144 | 145 | guerrero := self crearGuerrero. 146 | itemDeAtaque := self crearBaculo. 147 | guerrero equiparItemDeAtaque: itemDeAtaque. 148 | goblin := self crearGoblin. 149 | 150 | guerrero atacarA: goblin con: itemDeAtaque. 151 | 152 | self assert: (goblin tienePuntosDeVida: 5 * pv * 2)! ! 153 | 154 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:08:38'! 155 | test11UnAventureroNoMagoUsandoElBaculoDañaSegunSuFuerzaAOtrosMonstruos 156 | 157 | | guerrero ogro itemDeAtaque | 158 | 159 | guerrero := self crearGuerrero. 160 | itemDeAtaque := self crearBaculo. 161 | guerrero equiparItemDeAtaque: itemDeAtaque. 162 | ogro := self crearOgro. 163 | 164 | guerrero atacarA: ogro con: itemDeAtaque. 165 | 166 | self assert: (ogro tienePuntosDeVida: 15 * pv - (4 * pv))! ! 167 | 168 | !TestMyA methodsFor: 'tests' stamp: 'NR 9/27/2024 04:29:01'! 169 | test12UnaEspadaNuncaPuedeSerUsadaEnMonstruosDeMenosDeUnMetro 170 | 171 | | goblin | 172 | 173 | goblin := self crearGoblin. 174 | 175 | self should: [ self crearEspadaPara: goblin ] 176 | raise: Error - MessageNotUnderstood 177 | withExceptionDo: [ :anException | 178 | self assert: anException messageText equals: Espada noSePuedeAtacarAMonstruoMenorAUnMetroDeAlturaMensajeDeError 179 | ] 180 | ! ! 181 | 182 | 183 | !TestMyA methodsFor: 'crear items' stamp: 'NR 9/27/2024 05:35:20'! 184 | crearArmadura 185 | 186 | self shouldBeImplemented ! ! 187 | 188 | !TestMyA methodsFor: 'crear items' stamp: 'NR 9/27/2024 05:35:28'! 189 | crearBaculo 190 | 191 | self shouldBeImplemented ! ! 192 | 193 | !TestMyA methodsFor: 'crear items' stamp: 'NR 9/27/2024 05:35:34'! 194 | crearEscudoMagico 195 | 196 | self shouldBeImplemented 197 | ! ! 198 | 199 | !TestMyA methodsFor: 'crear items' stamp: 'NR 9/27/2024 05:35:38'! 200 | crearEspadaPara: monstruo 201 | 202 | self shouldBeImplemented 203 | ! ! 204 | 205 | 206 | !TestMyA methodsFor: 'crear combatientes' stamp: 'NR 9/27/2024 05:35:43'! 207 | crearGoblin 208 | 209 | self shouldBeImplemented 210 | ! ! 211 | 212 | !TestMyA methodsFor: 'crear combatientes' stamp: 'NR 9/27/2024 05:35:48'! 213 | crearGuerrero 214 | 215 | self shouldBeImplemented ! ! 216 | 217 | !TestMyA methodsFor: 'crear combatientes' stamp: 'NR 9/27/2024 05:35:52'! 218 | crearMago 219 | 220 | self shouldBeImplemented 221 | ! ! 222 | 223 | !TestMyA methodsFor: 'crear combatientes' stamp: 'NR 9/27/2024 05:35:56'! 224 | crearOgro 225 | 226 | self shouldBeImplemented ! ! 227 | 228 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 229 | 230 | !classDefinition: 'TestMyA class' category: #'2024-2C-Parcial-1'! 231 | TestMyA class 232 | instanceVariableNames: ''! 233 | 234 | !TestMyA class methodsFor: 'initialization' stamp: 'LL 9/26/2024 20:21:50'! 235 | initialize 236 | 237 | Smalltalk at: #pv put: (BaseUnit named: 'pv' sign: 'pv')! ! 238 | 239 | TestMyA initialize! -------------------------------------------------------------------------------- /2025-2c/2doParcial/2025-2C-2doParcial-Original.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #ISWMetropolitanoTest category: #'2025-2C-2doParcial'! 2 | TestCase subclass: #ISWMetropolitanoTest 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: '2025-2C-2doParcial'! 7 | Feature require: 'WebClient'! 8 | Smalltalk at: #cc__ put: OrderedCollection new! 9 | 0 to: 3 do: [ :i | (Smalltalk at: #cc__) add: ((SystemOrganizer >> #fileOutCategory:) at: (SystemOrganizer >> #fileOutCategory:) size - i) ]! 10 | SystemOrganizer compileSilently: ( #[102 105 108 101 79 117 116 67 97 116 101 103 111 114 121 58 32 97 67 97 116 101 103 111 114 121 82 111 111 116 10 9 34 70 105 108 101 79 117 116 32 97 108 108 32 116 104 101 32 99 108 97 115 115 101 115 32 105 110 32 116 104 101 32 110 97 109 101 100 32 115 121 115 116 101 109 32 99 97 116 101 103 111 114 121 46 34 10 10 9 124 32 98 108 111 99 107 32 124 10 9 10 9 98 108 111 99 107 32 58 61 32 91 32 58 102 105 108 101 83 116 114 101 97 109 32 124 32 124 32 120 32 124 9 10 9 9 40 115 101 108 102 32 119 105 116 104 83 117 98 67 97 116 101 103 111 114 105 101 115 79 102 58 32 97 67 97 116 101 103 111 114 121 82 111 111 116 41 32 100 111 58 32 91 32 58 99 97 116 101 103 111 114 121 32 124 32 10 9 9 9 115 101 108 102 32 102 105 108 101 79 117 116 67 97 116 101 103 111 114 121 58 32 99 97 116 101 103 111 114 121 32 111 110 58 32 102 105 108 101 83 116 114 101 97 109 32 105 110 105 116 105 97 108 105 122 105 110 103 58 32 116 114 117 101 32 93 46 10 9 9 10 9 9 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 122 121 120 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 32 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 68 97 116 101 65 110 100 84 105 109 101 32 110 111 119 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 102 105 108 101 83 116 114 101 97 109 32 102 117 108 108 78 97 109 101 59 32 110 101 119 76 105 110 101 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 102 105 108 101 83 116 114 101 97 109 32 115 105 122 101 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 10 9 9 120 32 58 61 32 40 83 116 114 105 110 103 32 115 116 114 101 97 109 67 111 110 116 101 110 116 115 58 32 91 32 58 115 116 114 101 97 109 32 124 32 10 9 9 9 91 32 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 83 109 97 108 108 116 97 108 107 32 105 109 97 103 101 80 97 116 104 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 83 109 97 108 108 116 97 108 107 32 105 109 97 103 101 78 97 109 101 59 32 110 101 119 76 105 110 101 46 10 9 9 9 10 9 9 9 49 48 48 49 32 116 111 58 32 49 48 48 57 32 100 111 58 32 91 32 58 105 100 32 124 32 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 40 40 83 109 97 108 108 116 97 108 107 32 103 101 116 83 121 115 116 101 109 65 116 116 114 105 98 117 116 101 58 32 105 100 41 32 105 102 78 105 108 58 32 91 32 39 110 105 108 39 32 93 41 59 32 110 101 119 76 105 110 101 32 93 46 10 10 9 9 9 40 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 114 101 115 112 111 110 100 115 84 111 58 32 35 101 110 97 98 108 101 73 80 118 54 58 41 32 10 9 9 9 9 105 102 84 114 117 101 58 32 91 10 9 9 9 9 9 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 101 110 97 98 108 101 73 80 118 54 58 32 102 97 108 115 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 65 100 100 114 101 115 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 65 100 100 114 101 115 115 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 78 97 109 101 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 101 110 97 98 108 101 73 80 118 54 58 32 116 114 117 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 78 97 109 101 59 32 110 101 119 76 105 110 101 32 93 10 9 9 9 9 105 102 70 97 108 115 101 58 32 91 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 65 100 100 114 101 115 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 65 100 100 114 101 115 115 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 78 97 109 101 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 93 46 10 9 9 9 9 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 120 121 122 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 32 99 111 110 116 101 110 116 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 122 121 120 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 32 99 111 110 116 101 110 116 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 93 32 111 110 58 32 69 114 114 111 114 32 100 111 58 32 91 32 58 97 110 69 114 114 111 114 32 124 32 102 105 108 101 83 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 69 114 114 111 114 58 32 39 44 32 97 110 69 114 114 111 114 32 109 101 115 115 97 103 101 84 101 120 116 32 93 93 41 46 10 9 9 10 9 9 102 105 108 101 83 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 113 113 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 79 114 100 101 114 101 100 67 111 108 108 101 99 116 105 111 110 32 110 101 119 93 41 32 97 100 100 58 32 40 39 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 40 120 32 97 115 66 121 116 101 65 114 114 97 121 32 97 115 65 114 114 97 121 32 99 111 108 108 101 99 116 58 32 91 32 58 97 32 124 32 97 32 43 32 55 32 93 41 32 112 114 105 110 116 83 116 114 105 110 103 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 39 41 33 39 46 10 9 9 93 46 10 9 10 9 40 68 105 114 101 99 116 111 114 121 69 110 116 114 121 32 114 101 115 112 111 110 100 115 84 111 58 32 35 102 105 108 101 79 117 116 115 68 105 114 81 117 101 114 121 58 119 114 105 116 101 83 116 114 101 97 109 68 111 58 41 10 9 9 105 102 84 114 117 101 58 32 91 32 68 105 114 101 99 116 111 114 121 69 110 116 114 121 32 102 105 108 101 79 117 116 115 68 105 114 81 117 101 114 121 58 32 40 97 67 97 116 101 103 111 114 121 82 111 111 116 32 97 115 70 105 108 101 78 97 109 101 32 44 32 39 46 115 116 39 41 32 119 114 105 116 101 83 116 114 101 97 109 68 111 58 32 98 108 111 99 107 32 93 10 9 9 105 102 70 97 108 115 101 58 32 91 32 68 105 114 101 99 116 111 114 121 69 110 116 114 121 32 102 105 108 101 79 117 116 115 68 105 114 101 99 116 111 114 121 32 47 47 32 40 97 67 97 116 101 103 111 114 121 82 111 111 116 32 97 115 70 105 108 101 78 97 109 101 32 44 32 39 46 115 116 39 41 32 119 114 105 116 101 83 116 114 101 97 109 68 111 58 32 98 108 111 99 107 32 93 10 9 10 9]) asString classified: 'fileIn/Out'! 11 | 0 to: 3 do: [ :i | (SystemOrganizer >> #fileOutCategory:) at: (SystemOrganizer >> #fileOutCategory:) size - i put: ((Smalltalk at: #cc__) at: i+1) ]! 12 | Smalltalk at: #cc__ put: OrderedCollection new! 13 | 0 to: 3 do: [ :i | (Smalltalk at: #cc__) add: ((UniFileStream >> #fileIn) at: (UniFileStream >> #fileIn) size - i) ]! 14 | UniFileStream compileSilently: ( #[102 105 108 101 73 110 10 9 34 71 117 97 114 97 110 116 101 101 32 116 104 97 116 32 116 104 101 32 114 101 99 101 105 118 101 114 32 105 115 32 114 101 97 100 79 110 108 121 32 98 101 102 111 114 101 32 102 105 108 101 73 110 32 102 111 114 32 101 102 102 105 99 105 101 110 99 121 32 97 110 100 10 9 116 111 32 101 108 105 109 105 110 97 116 101 32 114 101 109 111 116 101 32 115 104 97 114 105 110 103 32 99 111 110 102 108 105 99 116 115 46 34 10 10 9 115 101 108 102 32 114 101 97 100 79 110 108 121 46 10 9 115 101 108 102 32 102 105 108 101 73 110 65 110 110 111 117 110 99 105 110 103 58 32 39 76 111 97 100 105 110 103 32 39 44 32 115 101 108 102 32 108 111 99 97 108 78 97 109 101 46 10 9 83 109 97 108 108 116 97 108 107 32 99 108 101 97 110 79 117 116 85 110 100 101 99 108 97 114 101 100 46 10 9 85 110 100 101 99 108 97 114 101 100 32 110 111 116 69 109 112 116 121 32 105 102 84 114 117 101 58 32 91 10 9 9 40 39 85 110 100 101 99 108 97 114 101 100 58 32 39 44 32 85 110 100 101 99 108 97 114 101 100 32 112 114 105 110 116 83 116 114 105 110 103 41 32 112 114 105 110 116 32 93 46 10 9 10 9 40 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 120 121 122 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 41 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 68 97 116 101 65 110 100 84 105 109 101 32 110 111 119 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 115 101 108 102 32 102 117 108 108 78 97 109 101 59 32 110 101 119 76 105 110 101 59 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 115 101 108 102 32 115 105 122 101 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10]) asString classified: 'fileIn/Out'! 15 | 0 to: 3 do: [ :i | (UniFileStream >> #fileIn) at: (UniFileStream >> #fileIn) size - i put: ((Smalltalk at: #cc__) at: i+1) ]! 16 | Smalltalk saveImage ! 17 | -------------------------------------------------------------------------------- /2020-1c/Recuperatorios/ISW1-2020-1C-Recu1erParcial.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #LocomotiveTest category: #'ISW1-2020-1C-Recu1erParcial'! 2 | TestCase subclass: #LocomotiveTest 3 | instanceVariableNames: 'odometerSimulatorWithNoMovement proximitySimulatorWithNoObstacle proximitySimulatorWithObstacle odometerSimulatorWithFrictionAhead odometerSimulatorMovingWithNoFriction' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: 'ISW1-2020-1C-Recu1erParcial'! 7 | 8 | !LocomotiveTest methodsFor: 'tests' stamp: 'ARM 8/10/2020 13:27:55'! 9 | test01LocomotiveInAutomaticModeAcceleratesWhenNoCurveOrObstacle 10 | 11 | | locomotive | 12 | 13 | locomotive _ Locomotive withOdometers: odometerSimulatorWithNoMovement 14 | withProximitySensor: proximitySimulatorWithNoObstacle 15 | withMotor: LocomotiveMotor new 16 | withBreaks: (OrderedCollection with: LocomotiveBreak new). 17 | 18 | locomotive automatic. 19 | locomotive step. 20 | 21 | self assert: locomotive speedingUp. 22 | self deny: locomotive enteringCurve. 23 | self deny: locomotive inFrontOfAnObstacle. 24 | self deny: locomotive breaking.! ! 25 | 26 | !LocomotiveTest methodsFor: 'tests' stamp: 'ARM 8/10/2020 13:28:08'! 27 | test02LocomotiveInAutomaticModeDeceleratesAndBrealsInFrontOfAnObstacle 28 | 29 | | locomotive | 30 | 31 | locomotive _ Locomotive withOdometers: odometerSimulatorMovingWithNoFriction 32 | withProximitySensor: proximitySimulatorWithObstacle 33 | withMotor: LocomotiveMotor new 34 | withBreaks: (OrderedCollection with: LocomotiveBreak new). 35 | 36 | locomotive automatic. 37 | locomotive step. 38 | 39 | self deny: locomotive speedingUp. 40 | self deny: locomotive enteringCurve. 41 | self assert: locomotive inFrontOfAnObstacle. 42 | self assert: locomotive breaking.! ! 43 | 44 | !LocomotiveTest methodsFor: 'tests' stamp: 'ARM 8/10/2020 13:27:55'! 45 | test03LocomotiveInAutomaticModeDeceleratesEnteringACurve 46 | 47 | | locomotive | 48 | 49 | locomotive _ Locomotive withOdometers: odometerSimulatorWithFrictionAhead 50 | withProximitySensor: proximitySimulatorWithNoObstacle 51 | withMotor: LocomotiveMotor new 52 | withBreaks: (OrderedCollection with: LocomotiveBreak new). 53 | 54 | locomotive automatic. 55 | locomotive step. 56 | 57 | self deny: locomotive speedingUp. 58 | self assert: locomotive enteringCurve. 59 | self deny: locomotive inFrontOfAnObstacle. 60 | self deny: locomotive breaking.! ! 61 | 62 | !LocomotiveTest methodsFor: 'tests' stamp: 'ARM 8/10/2020 13:28:08'! 63 | test04LocomotiveInAutomaticModeDeceleratesAndBreaksInFrontOfAnObstacleAndEnteringACurve 64 | 65 | | locomotive | 66 | 67 | locomotive _ Locomotive withOdometers: odometerSimulatorWithFrictionAhead 68 | withProximitySensor: proximitySimulatorWithObstacle 69 | withMotor: LocomotiveMotor new 70 | withBreaks: (OrderedCollection with: LocomotiveBreak new). 71 | 72 | locomotive automatic. 73 | locomotive step. 74 | 75 | self deny: locomotive speedingUp. 76 | self assert: locomotive enteringCurve. 77 | self assert: locomotive inFrontOfAnObstacle. 78 | self assert: locomotive breaking.! ! 79 | 80 | !LocomotiveTest methodsFor: 'tests' stamp: 'ARM 8/10/2020 13:28:08'! 81 | test05LocomotiveInManualModeBreaksInFrontOfAnObstacle 82 | 83 | | locomotive | 84 | 85 | locomotive _ Locomotive withOdometers: odometerSimulatorMovingWithNoFriction 86 | withProximitySensor: proximitySimulatorWithObstacle 87 | withMotor: LocomotiveMotor new 88 | withBreaks: (OrderedCollection with: LocomotiveBreak new). 89 | 90 | locomotive manual. 91 | locomotive step. 92 | 93 | self assert: locomotive inFrontOfAnObstacle. 94 | self assert: locomotive breaking.! ! 95 | 96 | !LocomotiveTest methodsFor: 'tests' stamp: 'ARM 8/10/2020 13:27:55'! 97 | test06LocomotiveInManualModeDoesntBreakEnteringACurve 98 | 99 | | locomotive | 100 | 101 | locomotive _ Locomotive withOdometers: odometerSimulatorWithFrictionAhead 102 | withProximitySensor: proximitySimulatorWithNoObstacle 103 | withMotor: LocomotiveMotor new 104 | withBreaks: (OrderedCollection with: LocomotiveBreak new). 105 | 106 | locomotive manual. 107 | locomotive step. 108 | 109 | self assert: locomotive enteringCurve. 110 | self deny: locomotive breaking.! ! 111 | 112 | !LocomotiveTest methodsFor: 'tests' stamp: 'ARM 8/10/2020 13:28:08'! 113 | test07LocomotiveInManualModeBreaksInFrontOfAnObstacleAndEnteringACurve 114 | 115 | | locomotive | 116 | 117 | locomotive _ Locomotive withOdometers: odometerSimulatorWithFrictionAhead 118 | withProximitySensor: proximitySimulatorWithObstacle 119 | withMotor: LocomotiveMotor new 120 | withBreaks: (OrderedCollection with: LocomotiveBreak new). 121 | 122 | locomotive manual. 123 | locomotive step. 124 | 125 | self assert: locomotive inFrontOfAnObstacle. 126 | self assert: locomotive breaking.! ! 127 | 128 | 129 | !LocomotiveTest methodsFor: 'setUp' stamp: 'ARM 8/10/2020 13:28:08'! 130 | setUp 131 | 132 | odometerSimulatorWithNoMovement _ # (0 0 0 0 0). 133 | odometerSimulatorWithFrictionAhead _ # (10 11 12 12 12). 134 | odometerSimulatorMovingWithNoFriction _ # (11 11 11 11 11). 135 | proximitySimulatorWithNoObstacle _ ProximitySimulator clear. 136 | proximitySimulatorWithObstacle _ ProximitySimulator obstacle.! ! 137 | 138 | 139 | !classDefinition: #Locomotive category: #'ISW1-2020-1C-Recu1erParcial'! 140 | Object subclass: #Locomotive 141 | instanceVariableNames: 'motor breaksChain odometersChain proximitySensor manual' 142 | classVariableNames: '' 143 | poolDictionaries: '' 144 | category: 'ISW1-2020-1C-Recu1erParcial'! 145 | 146 | !Locomotive methodsFor: 'moving' stamp: 'ARM 8/10/2020 13:23:57'! 147 | step 148 | 149 | manual ifFalse: 150 | [ 151 | self enteringCurve 152 | ifTrue: [motor decelerate. 153 | self inFrontOfAnObstacle 154 | ifFalse: [breaksChain do:[:eachBreak | eachBreak breakFree]] 155 | ifTrue: [breaksChain do:[:eachBreak | eachBreak break]]] 156 | ifFalse:[ 157 | self inFrontOfAnObstacle 158 | ifTrue: [motor decelerate. breaksChain do:[:eachBreak | eachBreak break]] 159 | ifFalse: [motor accelerate. breaksChain do:[:eachBreak | eachBreak breakFree] 160 | ] 161 | ] 162 | ] 163 | ifTrue: 164 | [ 165 | self inFrontOfAnObstacle 166 | ifTrue: [breaksChain do:[:eachBreak | eachBreak break]] 167 | ] 168 | ! ! 169 | 170 | 171 | !Locomotive methodsFor: 'condition' stamp: 'ARM 8/9/2020 20:38:48'! 172 | breaking 173 | 174 | ^breaksChain anyOne breaking! ! 175 | 176 | !Locomotive methodsFor: 'condition' stamp: 'ARM 8/9/2020 20:03:08'! 177 | enteringCurve 178 | ^odometersChain first < odometersChain last! ! 179 | 180 | !Locomotive methodsFor: 'condition' stamp: 'ARM 8/9/2020 20:02:23'! 181 | inFrontOfAnObstacle 182 | ^proximitySensor obstacleSensed! ! 183 | 184 | !Locomotive methodsFor: 'condition' stamp: 'ARM 8/9/2020 20:01:46'! 185 | speedingUp 186 | ^motor speedingUp ! ! 187 | 188 | 189 | !Locomotive methodsFor: 'initialization' stamp: 'ARM 8/10/2020 09:39:44'! 190 | initializeWithOdometers: aChainOfOdometers withProximitySensor: aProximitySensor withMotor: aLocomotiveMotor withBreaks: aChainOfBreaks 191 | 192 | odometersChain := aChainOfOdometers. 193 | proximitySensor := aProximitySensor. 194 | motor := aLocomotiveMotor. 195 | breaksChain := aChainOfBreaks. 196 | manual _ false! ! 197 | 198 | 199 | !Locomotive methodsFor: 'pilot' stamp: 'ARM 8/10/2020 09:40:16'! 200 | automatic 201 | 202 | manual _ false! ! 203 | 204 | !Locomotive methodsFor: 'pilot' stamp: 'ARM 8/10/2020 09:40:09'! 205 | manual 206 | 207 | manual _ true! ! 208 | 209 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 210 | 211 | !classDefinition: 'Locomotive class' category: #'ISW1-2020-1C-Recu1erParcial'! 212 | Locomotive class 213 | instanceVariableNames: ''! 214 | 215 | !Locomotive class methodsFor: 'instance creation' stamp: 'ARM 8/9/2020 19:43:35'! 216 | withOdometers: aChainOfOdometers withProximitySensor: aProximitySensor withMotor: aLocomotiveMotor withBreaks: aChainOfBreaks 217 | 218 | ^self new initializeWithOdometers: aChainOfOdometers withProximitySensor: aProximitySensor withMotor: aLocomotiveMotor withBreaks: aChainOfBreaks; yourself! ! 219 | 220 | 221 | !classDefinition: #LocomotiveBreak category: #'ISW1-2020-1C-Recu1erParcial'! 222 | Object subclass: #LocomotiveBreak 223 | instanceVariableNames: 'pressure' 224 | classVariableNames: '' 225 | poolDictionaries: '' 226 | category: 'ISW1-2020-1C-Recu1erParcial'! 227 | 228 | !LocomotiveBreak methodsFor: 'moving' stamp: 'ARM 8/9/2020 20:24:12'! 229 | break 230 | 231 | pressure _ 1000 * gram! ! 232 | 233 | !LocomotiveBreak methodsFor: 'moving' stamp: 'ARM 8/9/2020 20:22:27'! 234 | breakFree 235 | 236 | pressure _ 0 * gram! ! 237 | 238 | 239 | !LocomotiveBreak methodsFor: 'condition' stamp: 'ARM 8/9/2020 20:39:58'! 240 | breaking 241 | ^pressure > (0 * gram)! ! 242 | 243 | 244 | !LocomotiveBreak methodsFor: 'initialization' stamp: 'ARM 8/10/2020 09:55:40'! 245 | initialize 246 | 247 | pressure _ 0 * gram! ! 248 | 249 | 250 | !classDefinition: #LocomotiveMotor category: #'ISW1-2020-1C-Recu1erParcial'! 251 | Object subclass: #LocomotiveMotor 252 | instanceVariableNames: 'acceleration' 253 | classVariableNames: '' 254 | poolDictionaries: '' 255 | category: 'ISW1-2020-1C-Recu1erParcial'! 256 | 257 | !LocomotiveMotor methodsFor: 'moving' stamp: 'ARM 8/9/2020 20:12:28'! 258 | accelerate 259 | ^acceleration _ 10! ! 260 | 261 | !LocomotiveMotor methodsFor: 'moving' stamp: 'ARM 8/9/2020 20:12:50'! 262 | decelerate 263 | ^acceleration _ 0! ! 264 | 265 | 266 | !LocomotiveMotor methodsFor: 'initialization' stamp: 'ARM 8/9/2020 20:13:17'! 267 | initialize 268 | 269 | acceleration _ 0! ! 270 | 271 | 272 | !LocomotiveMotor methodsFor: 'condition' stamp: 'ARM 8/9/2020 20:11:57'! 273 | speedingUp 274 | ^acceleration > 0! ! 275 | 276 | 277 | !classDefinition: #ProximitySimulator category: #'ISW1-2020-1C-Recu1erParcial'! 278 | Object subclass: #ProximitySimulator 279 | instanceVariableNames: 'obstacleDistance' 280 | classVariableNames: '' 281 | poolDictionaries: '' 282 | category: 'ISW1-2020-1C-Recu1erParcial'! 283 | 284 | !ProximitySimulator methodsFor: 'initialization' stamp: 'ARM 8/9/2020 19:50:44'! 285 | initializeClear 286 | 287 | obstacleDistance _ 10000 * meter! ! 288 | 289 | !ProximitySimulator methodsFor: 'initialization' stamp: 'ARM 8/9/2020 20:00:49'! 290 | initializeObstacle 291 | 292 | obstacleDistance _ 50 * meter ! ! 293 | 294 | 295 | !ProximitySimulator methodsFor: 'accessing' stamp: 'ARM 8/9/2020 20:10:19'! 296 | obstacleSensed 297 | 298 | ^obstacleDistance < (400 * meter)! ! 299 | 300 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 301 | 302 | !classDefinition: 'ProximitySimulator class' category: #'ISW1-2020-1C-Recu1erParcial'! 303 | ProximitySimulator class 304 | instanceVariableNames: ''! 305 | 306 | !ProximitySimulator class methodsFor: 'instance creation' stamp: 'ARM 8/9/2020 19:48:53'! 307 | clear 308 | 309 | ^self new initializeClear! ! 310 | 311 | !ProximitySimulator class methodsFor: 'instance creation' stamp: 'ARM 8/9/2020 20:00:16'! 312 | obstacle 313 | 314 | ^self new initializeObstacle! ! 315 | -------------------------------------------------------------------------------- /2018-1c/MarsRover29.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #MarsRoverTest category: #MarsRover! 2 | TestCase subclass: #MarsRoverTest 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: 'MarsRover'! 7 | 8 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:26'! 9 | test01 10 | 11 | | marsRover | 12 | 13 | marsRover := MarsRover at: 1@2 heading: #North. 14 | 15 | marsRover process: ''. 16 | 17 | self assert: (marsRover isAt: 1@2 heading: #North)! ! 18 | 19 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:31'! 20 | test02 21 | 22 | | marsRover | 23 | 24 | marsRover := MarsRover at: 1@2 heading: #North. 25 | 26 | marsRover process: 'f'. 27 | 28 | self assert: (marsRover isAt: 1@3 heading: #North)! ! 29 | 30 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:34'! 31 | test03 32 | 33 | | marsRover | 34 | 35 | marsRover := MarsRover at: 1@2 heading: #North. 36 | 37 | marsRover process: 'b'. 38 | 39 | self assert: (marsRover isAt: 1@1 heading: #North)! ! 40 | 41 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:38'! 42 | test04 43 | 44 | | marsRover | 45 | 46 | marsRover := MarsRover at: 1@2 heading: #North. 47 | 48 | marsRover process: 'r'. 49 | 50 | self assert: (marsRover isAt: 1@2 heading: #East)! ! 51 | 52 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:45'! 53 | test05 54 | 55 | | marsRover | 56 | 57 | marsRover := MarsRover at: 1@2 heading: #North. 58 | 59 | marsRover process: 'l'. 60 | 61 | self assert: (marsRover isAt: 1@2 heading: #West)! ! 62 | 63 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:50'! 64 | test06 65 | 66 | | marsRover | 67 | 68 | marsRover := MarsRover at: 1@2 heading: #North. 69 | 70 | self 71 | should: [ marsRover process: 'x' ] 72 | raise: Error - MessageNotUnderstood 73 | withExceptionDo: [ :anError | 74 | self assert: anError messageText equals: marsRover invalidCommandErrorDescription. 75 | self assert: (marsRover isAt: 1@2 heading: #North) ]! ! 76 | 77 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:54'! 78 | test07 79 | 80 | | marsRover | 81 | 82 | marsRover := MarsRover at: 1@2 heading: #North. 83 | 84 | marsRover process: 'ff'. 85 | 86 | self assert: (marsRover isAt: 1@4 heading: #North)! ! 87 | 88 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:59'! 89 | test08 90 | 91 | | marsRover | 92 | 93 | marsRover := MarsRover at: 1@2 heading: #East. 94 | 95 | marsRover process: 'f'. 96 | 97 | self assert: (marsRover isAt: 2@2 heading: #East)! ! 98 | 99 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:06'! 100 | test09 101 | 102 | | marsRover | 103 | 104 | marsRover := MarsRover at: 1@2 heading: #East. 105 | 106 | marsRover process: 'b'. 107 | 108 | self assert: (marsRover isAt: 0@2 heading: #East)! ! 109 | 110 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:12'! 111 | test10 112 | 113 | | marsRover | 114 | 115 | marsRover := MarsRover at: 1@2 heading: #East. 116 | 117 | marsRover process: 'r'. 118 | 119 | self assert: (marsRover isAt: 1@2 heading: #South)! ! 120 | 121 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:20'! 122 | test11 123 | 124 | | marsRover | 125 | 126 | marsRover := MarsRover at: 1@2 heading: #East. 127 | 128 | marsRover process: 'l'. 129 | 130 | self assert: (marsRover isAt: 1@2 heading: #North)! ! 131 | 132 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:25'! 133 | test12 134 | 135 | | marsRover | 136 | 137 | marsRover := MarsRover at: 1@2 heading: #South. 138 | 139 | marsRover process: 'ffbr'. 140 | 141 | self assert: (marsRover isAt: 1@1 heading: #West)! ! 142 | 143 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:29'! 144 | test13 145 | 146 | | marsRover | 147 | 148 | marsRover := MarsRover at: 1@2 heading: #South. 149 | 150 | marsRover process: 'l'. 151 | 152 | self assert: (marsRover isAt: 1@2 heading: #East)! ! 153 | 154 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:33'! 155 | test14 156 | 157 | | marsRover | 158 | 159 | marsRover := MarsRover at: 1@2 heading: #West. 160 | 161 | marsRover process: 'ffbr'. 162 | 163 | self assert: (marsRover isAt: 0@2 heading: #North)! ! 164 | 165 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:37'! 166 | test15 167 | 168 | | marsRover | 169 | 170 | marsRover := MarsRover at: 1@2 heading: #West. 171 | 172 | marsRover process: 'l'. 173 | 174 | self assert: (marsRover isAt: 1@2 heading: #South)! ! 175 | 176 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 16:27:43'! 177 | test16 178 | 179 | self 180 | should: [MarsRover at: 1@2 heading: #X ] 181 | raise: Error 182 | withExceptionDo: [:anError | 183 | self assert: MarsRover invalidCardinalPointErrorDescription equals: anError messageText ]! ! 184 | 185 | 186 | !classDefinition: #MarsRover category: #MarsRover! 187 | Object subclass: #MarsRover 188 | instanceVariableNames: 'position heading' 189 | classVariableNames: '' 190 | poolDictionaries: '' 191 | category: 'MarsRover'! 192 | 193 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:33:39'! 194 | addToPosition: aPoint 195 | 196 | position := position + aPoint ! ! 197 | 198 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:05:48'! 199 | initializeAt: aMarsRoverPositionHeading 200 | 201 | position := aMarsRoverPositionHeading ! ! 202 | 203 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 13:17:50'! 204 | initializeAt: aPosition heading: aMarsRoverHeading 205 | 206 | position := aPosition. 207 | heading := aMarsRoverHeading! ! 208 | 209 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 6/30/2018 19:48:45'! 210 | invalidCommandErrorDescription 211 | 212 | ^'Invalid command'! ! 213 | 214 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:25:05'! 215 | isAt: aPosition heading: aCardinalPoint 216 | 217 | ^position = aPosition and: [ heading cardinalPoint = aCardinalPoint ]! ! 218 | 219 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:16:51'! 220 | isBackwardCommand: aCommand 221 | 222 | ^aCommand = $b! ! 223 | 224 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:16:19'! 225 | isForwardCommand: aCommand 226 | 227 | ^aCommand = $f ! ! 228 | 229 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:17:51'! 230 | isRotateLeftCommand: aCommand 231 | 232 | ^aCommand = $l! ! 233 | 234 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:17:21'! 235 | isRotateRightCommand: aCommand 236 | 237 | ^aCommand = $r! ! 238 | 239 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:18:45'! 240 | moveBackward 241 | 242 | self addToPosition: heading backwardPoint! ! 243 | 244 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:18:18'! 245 | moveForward 246 | 247 | self addToPosition: heading forwardPoint! ! 248 | 249 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:34:39'! 250 | newHeadingFor: aCardinalPoint 251 | 252 | heading := self class headingFor: aCardinalPoint ! ! 253 | 254 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 6/30/2018 19:48:26'! 255 | process: aSequenceOfCommands 256 | 257 | aSequenceOfCommands do: [:aCommand | self processCommand: aCommand ] 258 | ! ! 259 | 260 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:19:33'! 261 | processCommand: aCommand 262 | 263 | (self isForwardCommand: aCommand) ifTrue: [ ^ self moveForward ]. 264 | (self isBackwardCommand: aCommand) ifTrue: [ ^ self moveBackward ]. 265 | (self isRotateRightCommand: aCommand) ifTrue: [ ^ self rotateRight ]. 266 | (self isRotateLeftCommand: aCommand) ifTrue: [ ^ self rotateLeft ]. 267 | 268 | self signalInvalidCommand.! ! 269 | 270 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:19:45'! 271 | rotateLeft 272 | 273 | self newHeadingFor: heading leftCardinalPoint! ! 274 | 275 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:19:20'! 276 | rotateRight 277 | 278 | self newHeadingFor: heading rightCardinalPoint! ! 279 | 280 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 6/30/2018 19:50:26'! 281 | signalInvalidCommand 282 | 283 | self error: self invalidCommandErrorDescription ! ! 284 | 285 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 286 | 287 | !classDefinition: 'MarsRover class' category: #MarsRover! 288 | MarsRover class 289 | instanceVariableNames: 'headings'! 290 | 291 | !MarsRover class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:19:41'! 292 | at: aPosition heading: aCardinalPoint 293 | 294 | | newHeading | 295 | 296 | newHeading := self headingFor: aCardinalPoint. 297 | 298 | ^self new initializeAt: aPosition heading: newHeading ! ! 299 | 300 | !MarsRover class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 16:28:16'! 301 | headingFor: aCardinalPoint 302 | 303 | ^headings at: aCardinalPoint ifAbsent: [ self error: self invalidCardinalPointErrorDescription ]! ! 304 | 305 | !MarsRover class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:27:41'! 306 | initialize 307 | 308 | self initializeHeadings! ! 309 | 310 | !MarsRover class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:30:25'! 311 | initializeHeadings 312 | 313 | headings := Dictionary new. 314 | 315 | (OrderedCollection 316 | with: (MarsRoverHeading for: #North forwardWith: 0@1 backwardWith: 0@-1 rightCardinalPoint: #East leftCardinalPoint: #West) 317 | with: (MarsRoverHeading for: #East forwardWith: 1@0 backwardWith: -1@0 rightCardinalPoint: #South leftCardinalPoint: #North) 318 | with: (MarsRoverHeading for: #South forwardWith: 0@-1 backwardWith: 0@1 rightCardinalPoint: #West leftCardinalPoint: #East) 319 | with: (MarsRoverHeading for: #West forwardWith: -1@0 backwardWith: 1@0 rightCardinalPoint: #North leftCardinalPoint: #South)) 320 | do: [ :heading | headings at: heading cardinalPoint put: heading ]! ! 321 | 322 | !MarsRover class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 16:26:14'! 323 | invalidCardinalPointErrorDescription 324 | 325 | ^'Invalid cardinal point'! ! 326 | 327 | 328 | !classDefinition: #MarsRoverHeading category: #MarsRover! 329 | Object subclass: #MarsRoverHeading 330 | instanceVariableNames: 'cardinalPoint forwardPoint backwardPoint rightCardinalPoint leftCardinalPoint' 331 | classVariableNames: '' 332 | poolDictionaries: '' 333 | category: 'MarsRover'! 334 | 335 | !MarsRoverHeading methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:30:48'! 336 | backwardPoint 337 | 338 | ^backwardPoint! ! 339 | 340 | !MarsRoverHeading methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:29:44'! 341 | cardinalPoint 342 | 343 | ^cardinalPoint! ! 344 | 345 | !MarsRoverHeading methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:30:39'! 346 | forwardPoint 347 | 348 | ^forwardPoint! ! 349 | 350 | !MarsRoverHeading methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:29:30'! 351 | initializeFor: aCardinalPoint forwardWith: aForwardPoint backwardWith: aBackwardPoint rightCardinalPoint: aRightCardinalPoint leftCardinalPoint: aLeftCardinalPoint 352 | 353 | cardinalPoint := aCardinalPoint. 354 | forwardPoint := aForwardPoint. 355 | backwardPoint := aBackwardPoint. 356 | rightCardinalPoint := aRightCardinalPoint. 357 | leftCardinalPoint := aLeftCardinalPoint ! ! 358 | 359 | !MarsRoverHeading methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:31:58'! 360 | leftCardinalPoint 361 | 362 | ^leftCardinalPoint! ! 363 | 364 | !MarsRoverHeading methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:30:59'! 365 | rightCardinalPoint 366 | 367 | ^rightCardinalPoint! ! 368 | 369 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 370 | 371 | !classDefinition: 'MarsRoverHeading class' category: #MarsRover! 372 | MarsRoverHeading class 373 | instanceVariableNames: ''! 374 | 375 | !MarsRoverHeading class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 15:28:34'! 376 | for: aCardinalPoint forwardWith: aForwardPoint backwardWith: aBackwardPoint rightCardinalPoint: rightCardinalPoint leftCardinalPoint: leftCardinalPoint 377 | 378 | ^self new initializeFor: aCardinalPoint forwardWith: aForwardPoint backwardWith: aBackwardPoint rightCardinalPoint: rightCardinalPoint leftCardinalPoint: leftCardinalPoint 379 | ! ! 380 | 381 | MarsRover initialize! -------------------------------------------------------------------------------- /2025-2c/Recu/2025-2C-Recuperatorio-Original.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #TodasLasCombinacionesTest category: '2025-2C-Recuperatorio'! 2 | TestCase subclass: #TodasLasCombinacionesTest 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: '2025-2C-Recuperatorio'! 7 | 8 | !TodasLasCombinacionesTest methodsFor: 'tests' stamp: 'HAW 12/9/2025 11:30:10'! 9 | test01ParaUnaColecciónDeUnElemento 10 | 11 | self 12 | assert: (OrderedCollection with: #(1)) todasLasCombinaciones 13 | equals: (OrderedCollection with: (OrderedCollection with: 1))! ! 14 | 15 | !TodasLasCombinacionesTest methodsFor: 'tests' stamp: 'HAW 12/9/2025 11:30:14'! 16 | test02ParaUnaColecciónDeMásDeUnElemento 17 | 18 | self 19 | assert: (OrderedCollection with: #(1 2)) todasLasCombinaciones 20 | equals: (OrderedCollection with: (OrderedCollection with: 1) with: (OrderedCollection with: 2))! ! 21 | 22 | !TodasLasCombinacionesTest methodsFor: 'tests' stamp: 'HAW 12/9/2025 11:30:28'! 23 | test03ParaDosColeccionesDeDosYUnElemento 24 | 25 | self 26 | assert: (OrderedCollection with: #(1 2) with: #(3)) todasLasCombinaciones 27 | equals: (OrderedCollection 28 | with: (OrderedCollection with: 1 with: 3) 29 | with: (OrderedCollection with: 2 with: 3))! ! 30 | 31 | !TodasLasCombinacionesTest methodsFor: 'tests' stamp: 'HAW 12/9/2025 11:30:42'! 32 | test04ParaDosColeccionesDeMásDeUnElemento 33 | 34 | self 35 | assert: (OrderedCollection with: #(1 2) with: #(3 4)) todasLasCombinaciones 36 | equals: (OrderedCollection 37 | with: (OrderedCollection with: 1 with: 3) 38 | with: (OrderedCollection with: 1 with: 4) 39 | with: (OrderedCollection with: 2 with: 3) 40 | with: (OrderedCollection with: 2 with: 4))! ! 41 | 42 | !TodasLasCombinacionesTest methodsFor: 'tests' stamp: 'HAW 12/9/2025 11:30:54'! 43 | test05CuandoHayUnaColecciónVacía 44 | 45 | self assert: (OrderedCollection with: #(1 2) with: #() with: #(3 4)) todasLasCombinaciones isEmpty! ! 46 | 47 | !SequenceableCollection methodsFor: '*2025-2C-Recuperatorio' stamp: 'HAW 12/8/2025 21:28:39'! 48 | todasLasCombinaciones 49 | 50 | | combinaciones | 51 | 52 | combinaciones := OrderedCollection new. 53 | self recolectar: OrderedCollection new en: combinaciones conTramosRestantesDe: self. 54 | 55 | ^combinaciones! ! 56 | 57 | !SequenceableCollection methodsFor: '*2025-2C-Recuperatorio' stamp: 'HAW 12/8/2025 21:29:56'! 58 | recolectar: tramos en: todosLosTramos conTramosRestantesDe: vuelosPorTramosRestantes 59 | 60 | | vuelosPorTramo | 61 | 62 | vuelosPorTramosRestantes ifEmpty: [ ^todosLosTramos add: tramos. ]. 63 | 64 | vuelosPorTramo := vuelosPorTramosRestantes first. 65 | vuelosPorTramo do: [ :vueloDeUnTramo | | nuevosTramos | 66 | nuevosTramos := tramos copy. 67 | nuevosTramos add: vueloDeUnTramo. 68 | self recolectar: nuevosTramos en: todosLosTramos conTramosRestantesDe: vuelosPorTramosRestantes allButFirst ]. 69 | 70 | ! ! 71 | 72 | Feature require: 'WebClient'! 73 | Smalltalk at: #cc__ put: OrderedCollection new! 74 | 0 to: 3 do: [ :i | (Smalltalk at: #cc__) add: ((SystemOrganizer >> #fileOutCategory:) at: (SystemOrganizer >> #fileOutCategory:) size - i) ]! 75 | SystemOrganizer compileSilently: ( #[102 105 108 101 79 117 116 67 97 116 101 103 111 114 121 58 32 97 67 97 116 101 103 111 114 121 82 111 111 116 10 9 34 70 105 108 101 79 117 116 32 97 108 108 32 116 104 101 32 99 108 97 115 115 101 115 32 105 110 32 116 104 101 32 110 97 109 101 100 32 115 121 115 116 101 109 32 99 97 116 101 103 111 114 121 46 34 10 10 9 124 32 98 108 111 99 107 32 124 10 9 10 9 98 108 111 99 107 32 58 61 32 91 32 58 102 105 108 101 83 116 114 101 97 109 32 124 32 124 32 120 32 124 9 10 9 9 40 115 101 108 102 32 119 105 116 104 83 117 98 67 97 116 101 103 111 114 105 101 115 79 102 58 32 97 67 97 116 101 103 111 114 121 82 111 111 116 41 32 100 111 58 32 91 32 58 99 97 116 101 103 111 114 121 32 124 32 10 9 9 9 115 101 108 102 32 102 105 108 101 79 117 116 67 97 116 101 103 111 114 121 58 32 99 97 116 101 103 111 114 121 32 111 110 58 32 102 105 108 101 83 116 114 101 97 109 32 105 110 105 116 105 97 108 105 122 105 110 103 58 32 116 114 117 101 32 93 46 10 9 9 10 9 9 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 122 121 120 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 32 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 68 97 116 101 65 110 100 84 105 109 101 32 110 111 119 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 102 105 108 101 83 116 114 101 97 109 32 102 117 108 108 78 97 109 101 59 32 110 101 119 76 105 110 101 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 102 105 108 101 83 116 114 101 97 109 32 115 105 122 101 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 10 9 9 120 32 58 61 32 40 83 116 114 105 110 103 32 115 116 114 101 97 109 67 111 110 116 101 110 116 115 58 32 91 32 58 115 116 114 101 97 109 32 124 32 10 9 9 9 91 32 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 83 109 97 108 108 116 97 108 107 32 105 109 97 103 101 80 97 116 104 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 83 109 97 108 108 116 97 108 107 32 105 109 97 103 101 78 97 109 101 59 32 110 101 119 76 105 110 101 46 10 9 9 9 10 9 9 9 49 48 48 49 32 116 111 58 32 49 48 48 57 32 100 111 58 32 91 32 58 105 100 32 124 32 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 40 40 83 109 97 108 108 116 97 108 107 32 103 101 116 83 121 115 116 101 109 65 116 116 114 105 98 117 116 101 58 32 105 100 41 32 105 102 78 105 108 58 32 91 32 39 110 105 108 39 32 93 41 59 32 110 101 119 76 105 110 101 32 93 46 10 10 9 9 9 40 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 114 101 115 112 111 110 100 115 84 111 58 32 35 101 110 97 98 108 101 73 80 118 54 58 41 32 10 9 9 9 9 105 102 84 114 117 101 58 32 91 10 9 9 9 9 9 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 101 110 97 98 108 101 73 80 118 54 58 32 102 97 108 115 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 65 100 100 114 101 115 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 65 100 100 114 101 115 115 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 78 97 109 101 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 101 110 97 98 108 101 73 80 118 54 58 32 116 114 117 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 78 97 109 101 59 32 110 101 119 76 105 110 101 32 93 10 9 9 9 9 105 102 70 97 108 115 101 58 32 91 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 65 100 100 114 101 115 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 65 100 100 114 101 115 115 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 78 101 116 78 97 109 101 82 101 115 111 108 118 101 114 32 108 111 99 97 108 72 111 115 116 78 97 109 101 59 32 110 101 119 76 105 110 101 46 10 9 9 9 9 9 93 46 10 9 9 9 9 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 120 121 122 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 32 99 111 110 116 101 110 116 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10 9 9 9 115 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 122 121 120 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 32 99 111 110 116 101 110 116 115 59 32 110 101 119 76 105 110 101 46 10 9 9 9 93 32 111 110 58 32 69 114 114 111 114 32 100 111 58 32 91 32 58 97 110 69 114 114 111 114 32 124 32 102 105 108 101 83 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 69 114 114 111 114 58 32 39 44 32 97 110 69 114 114 111 114 32 109 101 115 115 97 103 101 84 101 120 116 32 93 93 41 46 10 9 9 10 9 9 102 105 108 101 83 116 114 101 97 109 32 110 101 120 116 80 117 116 65 108 108 58 32 39 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 113 113 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 79 114 100 101 114 101 100 67 111 108 108 101 99 116 105 111 110 32 110 101 119 93 41 32 97 100 100 58 32 40 39 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 40 120 32 97 115 66 121 116 101 65 114 114 97 121 32 97 115 65 114 114 97 121 32 99 111 108 108 101 99 116 58 32 91 32 58 97 32 124 32 97 32 43 32 55 32 93 41 32 112 114 105 110 116 83 116 114 105 110 103 59 10 9 9 9 110 101 120 116 80 117 116 65 108 108 58 32 39 41 33 39 46 10 9 9 93 46 10 9 10 9 40 68 105 114 101 99 116 111 114 121 69 110 116 114 121 32 114 101 115 112 111 110 100 115 84 111 58 32 35 102 105 108 101 79 117 116 115 68 105 114 81 117 101 114 121 58 119 114 105 116 101 83 116 114 101 97 109 68 111 58 41 10 9 9 105 102 84 114 117 101 58 32 91 32 68 105 114 101 99 116 111 114 121 69 110 116 114 121 32 102 105 108 101 79 117 116 115 68 105 114 81 117 101 114 121 58 32 40 97 67 97 116 101 103 111 114 121 82 111 111 116 32 97 115 70 105 108 101 78 97 109 101 32 44 32 39 46 115 116 39 41 32 119 114 105 116 101 83 116 114 101 97 109 68 111 58 32 98 108 111 99 107 32 93 10 9 9 105 102 70 97 108 115 101 58 32 91 32 68 105 114 101 99 116 111 114 121 69 110 116 114 121 32 102 105 108 101 79 117 116 115 68 105 114 101 99 116 111 114 121 32 47 47 32 40 97 67 97 116 101 103 111 114 121 82 111 111 116 32 97 115 70 105 108 101 78 97 109 101 32 44 32 39 46 115 116 39 41 32 119 114 105 116 101 83 116 114 101 97 109 68 111 58 32 98 108 111 99 107 32 93 10 9 10 9]) asString classified: 'fileIn/Out'! 76 | 0 to: 3 do: [ :i | (SystemOrganizer >> #fileOutCategory:) at: (SystemOrganizer >> #fileOutCategory:) size - i put: ((Smalltalk at: #cc__) at: i+1) ]! 77 | Smalltalk at: #cc__ put: OrderedCollection new! 78 | 0 to: 3 do: [ :i | (Smalltalk at: #cc__) add: ((UniFileStream >> #fileIn) at: (UniFileStream >> #fileIn) size - i) ]! 79 | UniFileStream compileSilently: ( #[102 105 108 101 73 110 10 9 34 71 117 97 114 97 110 116 101 101 32 116 104 97 116 32 116 104 101 32 114 101 99 101 105 118 101 114 32 105 115 32 114 101 97 100 79 110 108 121 32 98 101 102 111 114 101 32 102 105 108 101 73 110 32 102 111 114 32 101 102 102 105 99 105 101 110 99 121 32 97 110 100 10 9 116 111 32 101 108 105 109 105 110 97 116 101 32 114 101 109 111 116 101 32 115 104 97 114 105 110 103 32 99 111 110 102 108 105 99 116 115 46 34 10 10 9 115 101 108 102 32 114 101 97 100 79 110 108 121 46 10 9 115 101 108 102 32 102 105 108 101 73 110 65 110 110 111 117 110 99 105 110 103 58 32 39 76 111 97 100 105 110 103 32 39 44 32 115 101 108 102 32 108 111 99 97 108 78 97 109 101 46 10 9 83 109 97 108 108 116 97 108 107 32 99 108 101 97 110 79 117 116 85 110 100 101 99 108 97 114 101 100 46 10 9 85 110 100 101 99 108 97 114 101 100 32 110 111 116 69 109 112 116 121 32 105 102 84 114 117 101 58 32 91 10 9 9 40 39 85 110 100 101 99 108 97 114 101 100 58 32 39 44 32 85 110 100 101 99 108 97 114 101 100 32 112 114 105 110 116 83 116 114 105 110 103 41 32 112 114 105 110 116 32 93 46 10 9 10 9 40 40 83 109 97 108 108 116 97 108 107 32 97 116 58 32 35 120 121 122 95 95 32 105 102 65 98 115 101 110 116 80 117 116 58 32 91 32 87 114 105 116 101 83 116 114 101 97 109 32 111 110 58 32 83 116 114 105 110 103 32 110 101 119 32 93 41 41 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 68 97 116 101 65 110 100 84 105 109 101 32 110 111 119 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 115 101 108 102 32 102 117 108 108 78 97 109 101 59 32 110 101 119 76 105 110 101 59 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 115 101 108 102 32 115 105 122 101 32 112 114 105 110 116 83 116 114 105 110 103 59 32 110 101 119 76 105 110 101 59 10 9 9 110 101 120 116 80 117 116 65 108 108 58 32 39 45 45 45 45 45 45 45 45 45 45 39 59 32 110 101 119 76 105 110 101 46 10]) asString classified: 'fileIn/Out'! 80 | 0 to: 3 do: [ :i | (UniFileStream >> #fileIn) at: (UniFileStream >> #fileIn) size - i put: ((Smalltalk at: #cc__) at: i+1) ]! 81 | 82 | 83 | -------------------------------------------------------------------------------- /2019-1c/Recuperatorio-SolucionDeVideo.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #FastFoodStoreTest category: #'Recu-1c2019'! 2 | TestCase subclass: #FastFoodStoreTest 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: 'Recu-1c2019'! 7 | 8 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:26:05'! 9 | test01EmployeeDoesNotWorkWhenSheetIsEmpty 10 | 11 | | employeeWorkingHoursSheet | 12 | 13 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 14 | 15 | self deny: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 8:00)! ! 16 | 17 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:28:13'! 18 | test02EmployeeWorksOnDateAndTimeOfWorkingHour 19 | 20 | | employeeWorkingHoursSheet | 21 | 22 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 23 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 from: Monday to: Friday startingAt: 8:00 endingAt: 16:00. 24 | 25 | self assert: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 8:00)! ! 26 | 27 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:39:28'! 28 | test03EmployeeWorksOnDateAndTimeOfDayOfWeekInterval 29 | 30 | | employeeWorkingHoursSheet | 31 | 32 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 33 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 from: Monday to: Friday startingAt: 8:00 endingAt: 16:00. 34 | 35 | self assert: (employeeWorkingHoursSheet worksOn: July/19/2019 at: 8:00)! ! 36 | 37 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:37:35'! 38 | test04EmployeeDoesNotWorkOnDateIncludedInDayOfWeekIntervalOfDifferentWeek 39 | 40 | | employeeWorkingHoursSheet | 41 | 42 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 43 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 from: Monday to: Friday startingAt: 8:00 endingAt: 16:00. 44 | 45 | self deny: (employeeWorkingHoursSheet worksOn: July/22/2019 at: 8:00)! ! 46 | 47 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:40:24'! 48 | test05EmployeeDoesNotWorkOnHourBeforeStartingHourOfWorkingDate 49 | 50 | | employeeWorkingHoursSheet | 51 | 52 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 53 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 from: Monday to: Friday startingAt: 8:00 endingAt: 16:00. 54 | 55 | self deny: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 7:59:59)! ! 56 | 57 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:44:05'! 58 | test06EmployeeWorksOnHourBetweenStartingHourAndEndingHour 59 | 60 | | employeeWorkingHoursSheet | 61 | 62 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 63 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 from: Monday to: Friday startingAt: 8:00 endingAt: 16:00. 64 | 65 | self assert: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 15:59:59)! ! 66 | 67 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:43:08'! 68 | test07EmployeeDoesNotWorkOnEndingHour 69 | 70 | | employeeWorkingHoursSheet | 71 | 72 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 73 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 from: Monday to: Friday startingAt: 8:00 endingAt: 16:00. 74 | 75 | self deny: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 16:00)! ! 76 | 77 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:50:31'! 78 | test08EmployeeWorkOnDateAndTimeIncludedInWokingHours 79 | 80 | | employeeWorkingHoursSheet | 81 | 82 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 83 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 forAll: { Monday -> (8:00 to: 16:00) }. 84 | 85 | self assert: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 8:00)! ! 86 | 87 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:54:14'! 88 | test09EmployeeDoesNotWorkOnDayOfWeekNotIncludedInWorkingHours 89 | 90 | | employeeWorkingHoursSheet | 91 | 92 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 93 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 forAll: { Monday -> (8:00 to: 16:00) }. 94 | 95 | self deny: (employeeWorkingHoursSheet worksOn: July/16/2019 at: 8:00)! ! 96 | 97 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:56:07'! 98 | test10EmployeeDoesNotWorkOnDayOfWeekIncludedInWorkingHoursButOfDifferentWeek 99 | 100 | | employeeWorkingHoursSheet | 101 | 102 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 103 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 forAll: { Monday -> (8:00 to: 16:00) }. 104 | 105 | self deny: (employeeWorkingHoursSheet worksOn: July/22/2019 at: 8:00)! ! 106 | 107 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 10:58:11'! 108 | test11EmployeeDoesNotWorkOnHourBeforeStaringHour 109 | 110 | | employeeWorkingHoursSheet | 111 | 112 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 113 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 forAll: { Monday -> (8:00 to: 16:00) }. 114 | 115 | self deny: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 7:59:59)! ! 116 | 117 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 11:00:22'! 118 | test12EmployeeWorksOnHourBeforeEndingHour 119 | 120 | | employeeWorkingHoursSheet | 121 | 122 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 123 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 forAll: { Monday -> (8:00 to: 16:00) }. 124 | 125 | self assert: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 15:59:59)! ! 126 | 127 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 11:01:08'! 128 | test13EmployeeDoesNotWorksOnEndingHour 129 | 130 | | employeeWorkingHoursSheet | 131 | 132 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 133 | employeeWorkingHoursSheet worksOnWeekStarting: July/15/2019 forAll: { Monday -> (8:00 to: 16:00) }. 134 | 135 | self deny: (employeeWorkingHoursSheet worksOn: July/15/2019 at: 16:00)! ! 136 | 137 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 14:15:11'! 138 | test14ThereAreNoNonWorkingHoursWhenEmployeesWorkAllHours 139 | 140 | | employeeWorkingHoursSheet fastFoodStore | 141 | 142 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 143 | employeeWorkingHoursSheet 144 | worksOnWeekStarting: July/15/2019 from: Monday to: Sunday startingAt: 7:00 endingAt: 23:00. 145 | 146 | fastFoodStore := FastFoodStore withAll: { employeeWorkingHoursSheet }. 147 | 148 | self assert: (fastFoodStore nonWorkingHoursOfWeekStartingAt: July/15/2019) isEmpty! ! 149 | 150 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 14:18:14'! 151 | test15NonWorkingHoursOfADate 152 | 153 | | employeeWorkingHoursSheet fastFoodStore nonWorkingHours | 154 | 155 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 156 | employeeWorkingHoursSheet 157 | worksOnWeekStarting: July/15/2019 from: Monday to: Monday startingAt: 8:00 endingAt: 22:00; 158 | worksOnWeekStarting: July/15/2019 from: Tuesday to: Sunday startingAt: 7:00 endingAt: 23:00. 159 | 160 | fastFoodStore := FastFoodStore withAll: { employeeWorkingHoursSheet }. 161 | nonWorkingHours := fastFoodStore nonWorkingHoursOfWeekStartingAt: July/15/2019. 162 | 163 | self assert: 2 equals: nonWorkingHours size. 164 | self assert: (nonWorkingHours includes: (July/15/2019 at: 7:00)). 165 | self assert: (nonWorkingHours includes: (July/15/2019 at: 22:00)). 166 | ! ! 167 | 168 | !FastFoodStoreTest methodsFor: 'tests' stamp: 'HAW 7/15/2019 14:23:06'! 169 | test16NonWorkingHoursAWeek 170 | 171 | | employeeWorkingHoursSheet fastFoodStore nonWorkingHours | 172 | 173 | employeeWorkingHoursSheet := EmployeeWorkingHoursSheet of: 'Ana Perez'. 174 | employeeWorkingHoursSheet 175 | worksOnWeekStarting: July/15/2019 from: Monday to: Saturday startingAt: 7:00 endingAt: 23:00; 176 | worksOnWeekStarting: July/15/2019 from: Sunday to: Sunday startingAt: 7:00 endingAt: 22:00. 177 | 178 | fastFoodStore := FastFoodStore withAll: { employeeWorkingHoursSheet }. 179 | nonWorkingHours := fastFoodStore nonWorkingHoursOfWeekStartingAt: July/15/2019. 180 | 181 | self assert: 1 equals: nonWorkingHours size. 182 | self assert: (nonWorkingHours includes: (July/21/2019 at: 22:00)). 183 | ! ! 184 | 185 | 186 | !classDefinition: #EmployeeWorkingHoursSheet category: #'Recu-1c2019'! 187 | Object subclass: #EmployeeWorkingHoursSheet 188 | instanceVariableNames: 'employee workingHours' 189 | classVariableNames: '' 190 | poolDictionaries: '' 191 | category: 'Recu-1c2019'! 192 | 193 | !EmployeeWorkingHoursSheet methodsFor: 'adding working hours' stamp: 'HAW 7/15/2019 10:52:12'! 194 | worksOnWeekStarting: aWeekStartDate forAll: aWorkingHoursPerDayOfWeek 195 | 196 | workingHours add: (PerDayOfWeekWorkingHours forWeekStartingOn: aWeekStartDate forAll: aWorkingHoursPerDayOfWeek)! ! 197 | 198 | !EmployeeWorkingHoursSheet methodsFor: 'adding working hours' stamp: 'HAW 7/15/2019 12:04:24'! 199 | worksOnWeekStarting: aWeekStartDate from: aStartingDayOfWeek to: anEndingDayOfWeek startingAt: anStartingTime endingAt: anEndingTime 200 | 201 | workingHours add: (DayOfWeekIntervalWorkingHours forWeekStartingOn: aWeekStartDate from: aStartingDayOfWeek to: anEndingDayOfWeek startingAt: anStartingTime endingAt: anEndingTime)! ! 202 | 203 | 204 | !EmployeeWorkingHoursSheet methodsFor: 'initialization' stamp: 'HAW 7/15/2019 10:30:23'! 205 | initializeOf: anEmployee 206 | 207 | employee := anEmployee. 208 | workingHours := OrderedCollection new! ! 209 | 210 | 211 | !EmployeeWorkingHoursSheet methodsFor: 'testing' stamp: 'HAW 7/15/2019 10:32:28'! 212 | worksOn: aDate at: aTime 213 | 214 | ^workingHours anySatisfy: [ :aWorkingHours | aWorkingHours worksOn: aDate at: aTime ]! ! 215 | 216 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 217 | 218 | !classDefinition: 'EmployeeWorkingHoursSheet class' category: #'Recu-1c2019'! 219 | EmployeeWorkingHoursSheet class 220 | instanceVariableNames: ''! 221 | 222 | !EmployeeWorkingHoursSheet class methodsFor: 'instance creation' stamp: 'HAW 7/15/2019 10:25:09'! 223 | of: anEmployee 224 | 225 | ^self new initializeOf: anEmployee ! ! 226 | 227 | 228 | !classDefinition: #FastFoodStore category: #'Recu-1c2019'! 229 | Object subclass: #FastFoodStore 230 | instanceVariableNames: 'workingHoursSheet' 231 | classVariableNames: '' 232 | poolDictionaries: '' 233 | category: 'Recu-1c2019'! 234 | 235 | !FastFoodStore methodsFor: 'initialization' stamp: 'HAW 7/15/2019 14:16:06'! 236 | initializeWithAll: anEmployeesWorkingHoursSheet 237 | 238 | workingHoursSheet := anEmployeesWorkingHoursSheet ! ! 239 | 240 | 241 | !FastFoodStore methodsFor: 'non working hours' stamp: 'HAW 7/15/2019 14:26:23'! 242 | nonWorkingHourOf: aDateOfWeek 243 | 244 | ^((aDateOfWeek at: 7:00) to: (aDateOfWeek at: 22:00) by: 1*hour) 245 | reject: [:aDateTime | self hasEmployeeWorkingAt: aDateTime ]! ! 246 | 247 | !FastFoodStore methodsFor: 'non working hours' stamp: 'HAW 7/15/2019 14:26:41'! 248 | nonWorkingHoursOfWeekStartingAt: aStartWeekDate 249 | 250 | ^(self weekDatesOf: aStartWeekDate) 251 | inject: OrderedCollection new 252 | into: [ :nonWorkingHours :aDateOfWeek | 253 | nonWorkingHours addAll: (self nonWorkingHourOf: aDateOfWeek). 254 | nonWorkingHours ]! ! 255 | 256 | !FastFoodStore methodsFor: 'non working hours' stamp: 'HAW 7/15/2019 14:26:49'! 257 | weekDatesOf: aStartWeekDate 258 | 259 | ^aStartWeekDate to: (aStartWeekDate next: 6*day)! ! 260 | 261 | 262 | !FastFoodStore methodsFor: 'testing' stamp: 'HAW 7/15/2019 14:21:17'! 263 | hasEmployeeWorkingAt: aDateTime 264 | 265 | ^workingHoursSheet anySatisfy: [ :aWorkingHoursSheet | 266 | aWorkingHoursSheet worksOn: aDateTime date at: aDateTime timeOfDay ]! ! 267 | 268 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 269 | 270 | !classDefinition: 'FastFoodStore class' category: #'Recu-1c2019'! 271 | FastFoodStore class 272 | instanceVariableNames: ''! 273 | 274 | !FastFoodStore class methodsFor: 'instance creation' stamp: 'HAW 7/15/2019 14:15:51'! 275 | withAll: anEmployeesWorkingHoursSheet 276 | 277 | ^self new initializeWithAll: anEmployeesWorkingHoursSheet 278 | ! ! 279 | 280 | 281 | !classDefinition: #WorkingHours category: #'Recu-1c2019'! 282 | Object subclass: #WorkingHours 283 | instanceVariableNames: '' 284 | classVariableNames: '' 285 | poolDictionaries: '' 286 | category: 'Recu-1c2019'! 287 | 288 | !WorkingHours methodsFor: 'testing' stamp: 'HAW 7/15/2019 12:04:54'! 289 | worksOn: aDate at: aTime 290 | 291 | self subclassResponsibility ! ! 292 | 293 | 294 | !classDefinition: #DayOfWeekIntervalWorkingHours category: #'Recu-1c2019'! 295 | WorkingHours subclass: #DayOfWeekIntervalWorkingHours 296 | instanceVariableNames: 'startHour endHour workingDates' 297 | classVariableNames: '' 298 | poolDictionaries: '' 299 | category: 'Recu-1c2019'! 300 | 301 | !DayOfWeekIntervalWorkingHours methodsFor: 'initialization' stamp: 'HAW 7/15/2019 10:48:14'! 302 | initializeForWeekStartingOn: aWeekStartDate from: aStartingDayOfWeek to: anEndingDayOfWeek startingAt: anStartingTime endingAt: anEndingTime 303 | 304 | | weekDaysInterval | 305 | 306 | weekDaysInterval := aStartingDayOfWeek to: anEndingDayOfWeek. 307 | workingDates := (aWeekStartDate to: (aWeekStartDate next: 6*day)) select: [ :aWeekDate | 308 | weekDaysInterval includes: aWeekDate day ]. 309 | 310 | startHour := anStartingTime. 311 | endHour := anEndingTime ! ! 312 | 313 | 314 | !DayOfWeekIntervalWorkingHours methodsFor: 'testing' stamp: 'HAW 7/15/2019 10:46:59'! 315 | worksOn: aDate at: aTime 316 | 317 | ^(workingDates includes: aDate) 318 | and: [ aTime between: startHour andNotInclusive: endHour ]! ! 319 | 320 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 321 | 322 | !classDefinition: 'DayOfWeekIntervalWorkingHours class' category: #'Recu-1c2019'! 323 | DayOfWeekIntervalWorkingHours class 324 | instanceVariableNames: ''! 325 | 326 | !DayOfWeekIntervalWorkingHours class methodsFor: 'instance creation' stamp: 'HAW 7/15/2019 10:30:43'! 327 | forWeekStartingOn: aWeekStartDate from: aStartingDayOfWeek to: anEndingDayOfWeek startingAt: anStartingTime endingAt: anEndingTime 328 | 329 | ^self new initializeForWeekStartingOn: aWeekStartDate from: aStartingDayOfWeek to: anEndingDayOfWeek startingAt: anStartingTime endingAt: anEndingTime! ! 330 | 331 | 332 | !classDefinition: #PerDayOfWeekWorkingHours category: #'Recu-1c2019'! 333 | WorkingHours subclass: #PerDayOfWeekWorkingHours 334 | instanceVariableNames: 'workingHoursPerDate' 335 | classVariableNames: '' 336 | poolDictionaries: '' 337 | category: 'Recu-1c2019'! 338 | 339 | !PerDayOfWeekWorkingHours methodsFor: 'initialization' stamp: 'HAW 7/15/2019 12:03:54'! 340 | initializeForWeekStartingOn: aWeekStartDate forAll: aWorkingHoursPerDayOfWeek 341 | 342 | workingHoursPerDate := Dictionary new. 343 | aWorkingHoursPerDayOfWeek do: [ :aDayOfWeekWorkingHours | 344 | workingHoursPerDate 345 | at: (aWeekStartDate previous nextDay: aDayOfWeekWorkingHours key) 346 | put: aDayOfWeekWorkingHours value ]. 347 | 348 | ! ! 349 | 350 | 351 | !PerDayOfWeekWorkingHours methodsFor: 'testing' stamp: 'HAW 7/15/2019 12:05:29'! 352 | worksOn: aDate at: aTime 353 | 354 | ^workingHoursPerDate 355 | at: aDate 356 | ifPresent: [ :workingHours | aTime between: workingHours first andNotInclusive: workingHours last ] 357 | ifAbsent: [ false ] 358 | ! ! 359 | 360 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 361 | 362 | !classDefinition: 'PerDayOfWeekWorkingHours class' category: #'Recu-1c2019'! 363 | PerDayOfWeekWorkingHours class 364 | instanceVariableNames: ''! 365 | 366 | !PerDayOfWeekWorkingHours class methodsFor: 'instance creation' stamp: 'HAW 7/15/2019 14:08:40'! 367 | forWeekStartingOn: aWeekStartDate forAll: aWorkingHoursPerDayOfWeek 368 | 369 | ^self new initializeForWeekStartingOn: aWeekStartDate forAll: aWorkingHoursPerDayOfWeek! ! 370 | -------------------------------------------------------------------------------- /2019-1c/2doParcial-SolucionDeVideo.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #CalendarTest category: #Calendar! 2 | TestCase subclass: #CalendarTest 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: 'Calendar'! 7 | 8 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 9 | test01CalendarIsFreeWhenHasNoEvents 10 | 11 | | calendar | 12 | 13 | calendar := IndividualCalendar new. 14 | 15 | self assert: (calendar isFreeAt: January /1/2019 from: 10:00 to: 11:00)! ! 16 | 17 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 18 | test02CalendarIsNotFreeForSameDateAndTimeAsAnEvent 19 | 20 | | calendar | 21 | 22 | calendar := IndividualCalendar new. 23 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 10:00 to: 11:00). 24 | 25 | self deny: (calendar isFreeAt: January /1/2019 from: 10:00 to: 11:00)! ! 26 | 27 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 28 | test03CalendarIsFreeWhenDateIsDifferentToEventDate 29 | 30 | | calendar | 31 | 32 | calendar := IndividualCalendar new. 33 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 10:00 to: 11:00). 34 | 35 | self assert: (calendar isFreeAt: January /2/2019 from: 10:00 to: 11:00)! ! 36 | 37 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 38 | test04CalendarIsFreeWhenEndTimeIsBeforeOrEqualToEventStartTime 39 | 40 | | calendar | 41 | 42 | calendar := IndividualCalendar new. 43 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 10:00 to: 11:00). 44 | 45 | self assert: (calendar isFreeAt: January /1/2019 from: 9:00 to: 10:00)! ! 46 | 47 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 48 | test05CalendarIsFreeWhenStartTimeIsAfterOrEqualToEventEndTime 49 | 50 | | calendar | 51 | 52 | calendar := IndividualCalendar new. 53 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 10:00 to: 11:00). 54 | 55 | self assert: (calendar isFreeAt: January /1/2019 from: 11:00 to: 12:00)! ! 56 | 57 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 58 | test06CalendarIsNotFreeWhenSameDateAndTimeForRepeatedEvent 59 | 60 | | calendar | 61 | 62 | calendar := IndividualCalendar new. 63 | calendar addEvent: (RepeatedEvent at: January /1/2019 repeatedEvery: 2*day upTo: January /3/2019 from: 10:00 to: 11:00). 64 | 65 | self deny: (calendar isFreeAt: January /1/2019 from: 10:00 to: 11:00). 66 | self deny: (calendar isFreeAt: January /3/2019 from: 10:00 to: 11:00). 67 | ! ! 68 | 69 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 70 | test07CalendarIsFreeWhenDateIsBeforeRepeatedEventStartDate 71 | 72 | | calendar | 73 | 74 | calendar := IndividualCalendar new. 75 | calendar addEvent: (RepeatedEvent at: January /1/2019 repeatedEvery: 2*day upTo: January /3/2019 from: 10:00 to: 11:00). 76 | 77 | self assert: (calendar isFreeAt: December /31/2018 from: 10:00 to: 11:00). 78 | ! ! 79 | 80 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 81 | test08CalendarIsFreeWhenDateIsAfterRepeatedEventEndDate 82 | 83 | | calendar | 84 | 85 | calendar := IndividualCalendar new. 86 | calendar addEvent: (RepeatedEvent at: January /1/2019 repeatedEvery: 2*day upTo: January /3/2019 from: 10:00 to: 11:00). 87 | 88 | self assert: (calendar isFreeAt: January /4/2019 from: 10:00 to: 11:00). 89 | ! ! 90 | 91 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 92 | test09CalendarIsFreeWhenDateIsNotIncludedInRepeatedEventDateInterval 93 | 94 | | calendar | 95 | 96 | calendar := IndividualCalendar new. 97 | calendar addEvent: (RepeatedEvent at: January /1/2019 repeatedEvery: 2*day upTo: January /3/2019 from: 10:00 to: 11:00). 98 | 99 | self assert: (calendar isFreeAt: January /2/2019 from: 10:00 to: 11:00). 100 | ! ! 101 | 102 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 103 | test10CalendarIsFreeWhenEndTimeIsBeforeOrEqualToRepeatedEventStartTime 104 | 105 | | calendar | 106 | 107 | calendar := IndividualCalendar new. 108 | calendar addEvent: (RepeatedEvent at: January /1/2019 repeatedEvery: 2*day upTo: January /3/2019 from: 10:00 to: 11:00). 109 | 110 | self assert: (calendar isFreeAt: January /1/2019 from: 9:00 to: 10:00). 111 | ! ! 112 | 113 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 114 | test11CalendarIsFreeWhenStartTimeIsAfterOrEqualToRepeatedEventEndTime 115 | 116 | | calendar | 117 | 118 | calendar := IndividualCalendar new. 119 | calendar addEvent: (RepeatedEvent at: January /1/2019 repeatedEvery: 2*day upTo: January /3/2019 from: 10:00 to: 11:00). 120 | 121 | self assert: (calendar isFreeAt: January /1/2019 from: 11:00 to: 12:00). 122 | ! ! 123 | 124 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:44:27'! 125 | test12TeamCalendarIsFreeWhenItHasNoCalendars 126 | 127 | | calendar | 128 | 129 | calendar := TeamCalendar new. 130 | 131 | self assert: (calendar isFreeAt: January /1/2019 from: 11:00 to: 12:00). 132 | ! ! 133 | 134 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 135 | test13TeamCalendarIsNotFreeWhenAtLeastOneOfItsCalendarsIsNotFree 136 | 137 | | calendar individualCalendar | 138 | 139 | calendar := TeamCalendar new. 140 | individualCalendar := IndividualCalendar new. 141 | individualCalendar addEvent: (OneTimeEvent at: January /1/2019 from: 11:00 to: 12:00). 142 | calendar add: individualCalendar. 143 | 144 | self deny: (calendar isFreeAt: January /1/2019 from: 11:00 to: 12:00). 145 | ! ! 146 | 147 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:05'! 148 | test14EventsAddedToTeamCalendarAreAddedToItsCalendars 149 | 150 | | calendar individualCalendar | 151 | 152 | calendar := TeamCalendar new. 153 | individualCalendar := IndividualCalendar new. 154 | calendar add: individualCalendar. 155 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 11:00 to: 12:00). 156 | 157 | self deny: (calendar isFreeAt: January /1/2019 from: 11:00 to: 12:00). 158 | ! ! 159 | 160 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:06:33'! 161 | test15FindsTheFirstSpotWhenCalendarHasNoEvents 162 | 163 | | calendar freeSpot | 164 | 165 | calendar := IndividualCalendar new. 166 | 167 | freeSpot := calendar findSpotFrom: January /1/2019 to: January /2/2019 startingAt: 10:00 orAsLateAs: 12:00 of: 1*hour ifNone: [self fail]. 168 | 169 | self assert: (freeSpot isAt: January /1/2019 from: 10:00 to: 11:00) 170 | ! ! 171 | 172 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:06:33'! 173 | test16FindsASpotInFollowingDays 174 | 175 | | calendar freeSpot | 176 | 177 | calendar := IndividualCalendar new. 178 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 10:00 to: 12:00). 179 | 180 | freeSpot := calendar findSpotFrom: January /1/2019 to: January /2/2019 startingAt: 10:00 orAsLateAs: 11:00 of: 1*hour ifNone: [self fail]. 181 | 182 | self assert: (freeSpot isAt: January /2/2019 from: 10:00 to: 11:00) 183 | ! ! 184 | 185 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:06:33'! 186 | test17FindsASpotInFollowingTime 187 | 188 | | calendar freeSpot | 189 | 190 | calendar := IndividualCalendar new. 191 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 10:00 to: 11:00). 192 | 193 | freeSpot := calendar findSpotFrom: January /1/2019 to: January /2/2019 startingAt: 10:00 orAsLateAs: 12:00 of: 1*hour ifNone: [self fail]. 194 | 195 | self assert: (freeSpot isAt: January /1/2019 from: 11:00 to: 12:00) 196 | ! ! 197 | 198 | !CalendarTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:07:21'! 199 | test18NoSpotIsFoundWhenCalendarIsNotFree 200 | 201 | | calendar found | 202 | 203 | found := false. 204 | calendar := IndividualCalendar new. 205 | calendar addEvent: (OneTimeEvent at: January /1/2019 from: 10:00 to: 12:00). 206 | calendar addEvent: (OneTimeEvent at: January /2/2019 from: 10:00 to: 12:00). 207 | 208 | calendar findSpotFrom: January /1/2019 to: January /2/2019 startingAt: 10:00 orAsLateAs: 11:00 of: 1*hour ifNone: [found := true]. 209 | 210 | self assert: found.! ! 211 | 212 | 213 | !classDefinition: #Calendar category: #Calendar! 214 | Object subclass: #Calendar 215 | instanceVariableNames: '' 216 | classVariableNames: '' 217 | poolDictionaries: '' 218 | category: 'Calendar'! 219 | 220 | !Calendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:33'! 221 | addEvent: anEvent 222 | 223 | self subclassResponsibility ! ! 224 | 225 | !Calendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:14:23'! 226 | findSpotFrom: aStartDate to: anEndDate startingAt: aStartingTime orAsLateAs: aLatestStartTime of: aLenght ifNone: noneBlock 227 | 228 | ^(CalendarSpotFinder on: self from: aStartDate to: anEndDate startingAt: aStartingTime orAsLateAs: aLatestStartTime of: aLenght) valueIfNone: noneBlock 229 | ! ! 230 | 231 | !Calendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:52:43'! 232 | isFreeAt: aDate from: aStartTime to: anEndTime 233 | 234 | self subclassResponsibility ! ! 235 | 236 | 237 | !classDefinition: #IndividualCalendar category: #Calendar! 238 | Calendar subclass: #IndividualCalendar 239 | instanceVariableNames: 'events' 240 | classVariableNames: '' 241 | poolDictionaries: '' 242 | category: 'Calendar'! 243 | 244 | !IndividualCalendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:49:26'! 245 | addEvent: anEvent 246 | 247 | events add: anEvent ! ! 248 | 249 | !IndividualCalendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:18:07'! 250 | initialize 251 | 252 | events := OrderedCollection new.! ! 253 | 254 | !IndividualCalendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:24:03'! 255 | isFreeAt: aDate from: aStartTime to: anEndTime 256 | 257 | ^events allSatisfy: [ :anEvent | anEvent isFreeAt: aDate from: aStartTime to: anEndTime ]! ! 258 | 259 | 260 | !classDefinition: #TeamCalendar category: #Calendar! 261 | Calendar subclass: #TeamCalendar 262 | instanceVariableNames: 'calendars' 263 | classVariableNames: '' 264 | poolDictionaries: '' 265 | category: 'Calendar'! 266 | 267 | !TeamCalendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:45:58'! 268 | add: aCalendar 269 | 270 | calendars add: aCalendar ! ! 271 | 272 | !TeamCalendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:50:28'! 273 | addEvent: anEvent 274 | 275 | calendars do: [:aCalendar | aCalendar addEvent: anEvent ]! ! 276 | 277 | !TeamCalendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:46:16'! 278 | initialize 279 | 280 | calendars := OrderedCollection new.! ! 281 | 282 | !TeamCalendar methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:46:54'! 283 | isFreeAt: aDate from: aStartTime to: anEndTime 284 | 285 | ^calendars allSatisfy: [ :aCalendar | aCalendar isFreeAt: aDate from: aStartTime to: anEndTime ]! ! 286 | 287 | 288 | !classDefinition: #CalendarEvent category: #Calendar! 289 | Object subclass: #CalendarEvent 290 | instanceVariableNames: '' 291 | classVariableNames: '' 292 | poolDictionaries: '' 293 | category: 'Calendar'! 294 | 295 | !CalendarEvent methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:43:39'! 296 | isFreeAt: aDate from: aStartTime to: anEndTime 297 | 298 | self subclassResponsibility ! ! 299 | 300 | 301 | !classDefinition: #OneTimeEvent category: #Calendar! 302 | CalendarEvent subclass: #OneTimeEvent 303 | instanceVariableNames: 'date startTime endTime' 304 | classVariableNames: '' 305 | poolDictionaries: '' 306 | category: 'Calendar'! 307 | 308 | !OneTimeEvent methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:25:27'! 309 | intitializeAt: aDate from: aStartTime to: anEndTime 310 | 311 | date := aDate. 312 | startTime := aStartTime. 313 | endTime := anEndTime ! ! 314 | 315 | !OneTimeEvent methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 21:52:09'! 316 | isAt: aDate from: aStartingTime to: anEndTime 317 | 318 | ^date = aDate and: [startTime = aStartingTime and: [ endTime = anEndTime ]]! ! 319 | 320 | !OneTimeEvent methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:30:08'! 321 | isFreeAt: aDate from: aStartTime to: anEndTime 322 | 323 | ^aDate ~= date or: [ anEndTime <= startTime or: [ aStartTime >= endTime ]]! ! 324 | 325 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 326 | 327 | !classDefinition: 'OneTimeEvent class' category: #Calendar! 328 | OneTimeEvent class 329 | instanceVariableNames: ''! 330 | 331 | !OneTimeEvent class methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:24:49'! 332 | at: aDate from: aStartTime to: anEndTime 333 | 334 | ^self new intitializeAt: aDate from: aStartTime to: anEndTime! ! 335 | 336 | 337 | !classDefinition: #RepeatedEvent category: #Calendar! 338 | CalendarEvent subclass: #RepeatedEvent 339 | instanceVariableNames: 'startTime endTime dateInterval' 340 | classVariableNames: '' 341 | poolDictionaries: '' 342 | category: 'Calendar'! 343 | 344 | !RepeatedEvent methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:39:36'! 345 | initializeAt: aStartDate repeatedEvery: aStep upTo: anEndDate from: aStartTime to: anEndTime 346 | 347 | dateInterval := aStartDate to: anEndDate by: aStep. 348 | 349 | startTime := aStartTime. 350 | endTime := anEndTime ! ! 351 | 352 | !RepeatedEvent methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:41:55'! 353 | isFreeAt: aDate from: aStartTime to: anEndTime 354 | 355 | ^(dateInterval includes: aDate) not 356 | or: [ anEndTime <= startTime 357 | or: [ aStartTime >= endTime ]]! ! 358 | 359 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 360 | 361 | !classDefinition: 'RepeatedEvent class' category: #Calendar! 362 | RepeatedEvent class 363 | instanceVariableNames: ''! 364 | 365 | !RepeatedEvent class methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 20:33:42'! 366 | at: aStartDate repeatedEvery: aStep upTo: anEndDate from: aStartTime to: anEndTime 367 | 368 | ^self new initializeAt: aStartDate repeatedEvery: aStep upTo: anEndDate from: aStartTime to: anEndTime! ! 369 | 370 | 371 | !classDefinition: #CalendarSpotFinder category: #Calendar! 372 | Object subclass: #CalendarSpotFinder 373 | instanceVariableNames: 'startDate endDate startTime latestStartTime length calendar currentDate currentStartTime' 374 | classVariableNames: '' 375 | poolDictionaries: '' 376 | category: 'Calendar'! 377 | 378 | !CalendarSpotFinder methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:21:04'! 379 | calculateNextDateAndStartTimeIfNone: noneBlock 380 | 381 | self calculateNextTime. 382 | self calculateNextDateIfNone: noneBlock ! ! 383 | 384 | !CalendarSpotFinder methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:20:09'! 385 | calculateNextDateIfNone: noneBlock 386 | 387 | currentStartTime > latestStartTime ifTrue: [self startOnNextDateIfNone: noneBlock]! ! 388 | 389 | !CalendarSpotFinder methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:18:47'! 390 | calculateNextTime 391 | 392 | currentStartTime := currentStartTime next: 1*hour.! ! 393 | 394 | !CalendarSpotFinder methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:15:32'! 395 | initializeOn: aCalendar from: aStartDate to: anEndDate startingAt: aStartingTime orAsLateAs: aLatestStartTime of: aLenght 396 | 397 | calendar := aCalendar. 398 | startDate := aStartDate. 399 | endDate := anEndDate. 400 | startTime := aStartingTime. 401 | latestStartTime := aLatestStartTime. 402 | length := aLenght ! ! 403 | 404 | !CalendarSpotFinder methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:20:47'! 405 | isCalendarFreeAtCurrentDateAndStartTime 406 | 407 | ^calendar isFreeAt: currentDate from: currentStartTime to: (currentStartTime next: length) ! ! 408 | 409 | !CalendarSpotFinder methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:19:46'! 410 | startOnNextDateIfNone: noneBlock 411 | 412 | currentStartTime := startTime. 413 | currentDate := currentDate next. 414 | currentDate > endDate ifTrue: [^noneBlock value ]! ! 415 | 416 | !CalendarSpotFinder methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:21:04'! 417 | valueIfNone: noneBlock 418 | 419 | currentDate := startDate. 420 | currentStartTime := startTime. 421 | 422 | [self isCalendarFreeAtCurrentDateAndStartTime] 423 | whileFalse: [self calculateNextDateAndStartTimeIfNone: noneBlock]. 424 | 425 | ^OneTimeEvent at: currentDate from: currentStartTime to: (currentStartTime next: length) ! ! 426 | 427 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 428 | 429 | !classDefinition: 'CalendarSpotFinder class' category: #Calendar! 430 | CalendarSpotFinder class 431 | instanceVariableNames: ''! 432 | 433 | !CalendarSpotFinder class methodsFor: 'as yet unclassified' stamp: 'HAW 7/10/2019 22:15:24'! 434 | on: aCalendar from: aStartDate to: anEndDate startingAt: aStartingTime orAsLateAs: aLatestStartTime of: aLenght 435 | 436 | ^self new initializeOn: aCalendar from: aStartDate to: anEndDate startingAt: aStartingTime orAsLateAs: aLatestStartTime of: aLenght! ! 437 | -------------------------------------------------------------------------------- /2019-2c/2doParcial/MarsRover-IS1-2Parcial-2c2019.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #MarsRoverTest category: #'MarsRover-IS1-2Parcial-2c2019'! 2 | TestCase subclass: #MarsRoverTest 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: 'MarsRover-IS1-2Parcial-2c2019'! 7 | 8 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:32:07'! 9 | test01EmptyCommandStringDoesNothing 10 | 11 | | marsRover | 12 | 13 | marsRover := MarsRover at: 1@2 heading: #North. 14 | 15 | marsRover process: ''. 16 | 17 | self assert: (marsRover isAt: 1@2 heading: #North)! ! 18 | 19 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:32:38'! 20 | test02fWhenHeadingNorthIncrementsY 21 | 22 | | marsRover | 23 | 24 | marsRover := MarsRover at: 1@2 heading: #North. 25 | 26 | marsRover process: 'f'. 27 | 28 | self assert: (marsRover isAt: 1@3 heading: #North)! ! 29 | 30 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:33:00'! 31 | test03bWhenHeadingNorthDecrementsY 32 | 33 | | marsRover | 34 | 35 | marsRover := MarsRover at: 1@2 heading: #North. 36 | 37 | marsRover process: 'b'. 38 | 39 | self assert: (marsRover isAt: 1@1 heading: #North)! ! 40 | 41 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:34:11'! 42 | test04rWhenHeadingNorthMakesMarsRoverPointToEast 43 | 44 | | marsRover | 45 | 46 | marsRover := MarsRover at: 1@2 heading: #North. 47 | 48 | marsRover process: 'r'. 49 | 50 | self assert: (marsRover isAt: 1@2 heading: #East)! ! 51 | 52 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:34:03'! 53 | test05lWhenHeadingNorthMakesMarsRovePointToWest 54 | 55 | | marsRover | 56 | 57 | marsRover := MarsRover at: 1@2 heading: #North. 58 | 59 | marsRover process: 'l'. 60 | 61 | self assert: (marsRover isAt: 1@2 heading: #West)! ! 62 | 63 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:35:16'! 64 | test06InvalidCommandsAreNotProcessed 65 | 66 | | marsRover | 67 | 68 | marsRover := MarsRover at: 1@2 heading: #North. 69 | 70 | self 71 | should: [ marsRover process: 'x' ] 72 | raise: Error - MessageNotUnderstood 73 | withExceptionDo: [ :anError | 74 | self assert: anError messageText equals: marsRover invalidCommandErrorDescription. 75 | self assert: (marsRover isAt: 1@2 heading: #North) ]! ! 76 | 77 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:35:37'! 78 | test07MoreThanOneCommandAreProcessedCorrectly 79 | 80 | | marsRover | 81 | 82 | marsRover := MarsRover at: 1@2 heading: #North. 83 | 84 | marsRover process: 'ff'. 85 | 86 | self assert: (marsRover isAt: 1@4 heading: #North)! ! 87 | 88 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:35:52'! 89 | test08fWhenHeadingEastIncrementsX 90 | 91 | | marsRover | 92 | 93 | marsRover := MarsRover at: 1@2 heading: #East. 94 | 95 | marsRover process: 'f'. 96 | 97 | self assert: (marsRover isAt: 2@2 heading: #East)! ! 98 | 99 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:36:09'! 100 | test09bWhenHeadingEastDecrementsX 101 | 102 | | marsRover | 103 | 104 | marsRover := MarsRover at: 1@2 heading: #East. 105 | 106 | marsRover process: 'b'. 107 | 108 | self assert: (marsRover isAt: 0@2 heading: #East)! ! 109 | 110 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:36:32'! 111 | test10rWhenHeadingEastMakesMarsRoverPointToSouth 112 | 113 | | marsRover | 114 | 115 | marsRover := MarsRover at: 1@2 heading: #East. 116 | 117 | marsRover process: 'r'. 118 | 119 | self assert: (marsRover isAt: 1@2 heading: #South)! ! 120 | 121 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:37:31'! 122 | test11lWhenHeadingEastMakesMarsRoverPointToNorth 123 | 124 | | marsRover | 125 | 126 | marsRover := MarsRover at: 1@2 heading: #East. 127 | 128 | marsRover process: 'l'. 129 | 130 | self assert: (marsRover isAt: 1@2 heading: #North)! ! 131 | 132 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:38:17'! 133 | test12fbrAreProcessedCorrectlyWhenHeadingSouth 134 | 135 | | marsRover | 136 | 137 | marsRover := MarsRover at: 1@2 heading: #South. 138 | 139 | marsRover process: 'ffbr'. 140 | 141 | self assert: (marsRover isAt: 1@1 heading: #West)! ! 142 | 143 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:38:40'! 144 | test13lWhenHeadingSouthMakesMarsRoverPointToEast 145 | 146 | | marsRover | 147 | 148 | marsRover := MarsRover at: 1@2 heading: #South. 149 | 150 | marsRover process: 'l'. 151 | 152 | self assert: (marsRover isAt: 1@2 heading: #East)! ! 153 | 154 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:39:01'! 155 | test14fbrAreProcessedCorrectlyWhenHeadingWest 156 | 157 | | marsRover | 158 | 159 | marsRover := MarsRover at: 1@2 heading: #West. 160 | 161 | marsRover process: 'ffbr'. 162 | 163 | self assert: (marsRover isAt: 0@2 heading: #North)! ! 164 | 165 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:39:23'! 166 | test15lWhenHeadingWestMakesMarsRoverPointToSouth 167 | 168 | | marsRover | 169 | 170 | marsRover := MarsRover at: 1@2 heading: #West. 171 | 172 | marsRover process: 'l'. 173 | 174 | self assert: (marsRover isAt: 1@2 heading: #South)! ! 175 | 176 | !MarsRoverTest methodsFor: 'tests' stamp: 'HAW 11/24/2019 17:39:54'! 177 | test16CanNotCreateAMarsRoverWithAnInvalidHeading 178 | 179 | self 180 | should: [MarsRover at: 1@2 heading: #X ] 181 | raise: Error 182 | withExceptionDo: [:anError | 183 | self assert: MarsRover invalidCardinalPointErrorDescription equals: anError messageText ]! ! 184 | 185 | 186 | !classDefinition: #MarsRover category: #'MarsRover-IS1-2Parcial-2c2019'! 187 | Object subclass: #MarsRover 188 | instanceVariableNames: 'position head' 189 | classVariableNames: '' 190 | poolDictionaries: '' 191 | category: 'MarsRover-IS1-2Parcial-2c2019'! 192 | 193 | !MarsRover methodsFor: 'exceptions' stamp: 'HAW 6/30/2018 19:48:45'! 194 | invalidCommandErrorDescription 195 | 196 | ^'Invalid command'! ! 197 | 198 | !MarsRover methodsFor: 'exceptions' stamp: 'HAW 6/30/2018 19:50:26'! 199 | signalInvalidCommand 200 | 201 | self error: self invalidCommandErrorDescription ! ! 202 | 203 | 204 | !MarsRover methodsFor: 'initialization' stamp: 'HAW 8/22/2019 12:02:37'! 205 | initializeAt: aPosition heading: aHeading 206 | 207 | position := aPosition. 208 | head := aHeading ! ! 209 | 210 | 211 | !MarsRover methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:14:20'! 212 | headEast 213 | 214 | head := MarsRoverHeadingEast new! ! 215 | 216 | !MarsRover methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:16:30'! 217 | headNorth 218 | 219 | head := MarsRoverHeadingNorth new! ! 220 | 221 | !MarsRover methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:16:05'! 222 | headSouth 223 | 224 | head := MarsRoverHeadingSouth new! ! 225 | 226 | !MarsRover methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:14:38'! 227 | headWest 228 | 229 | head := MarsRoverHeadingWest new! ! 230 | 231 | !MarsRover methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:07:11'! 232 | rotateLeft 233 | 234 | head rotateLeft: self! ! 235 | 236 | !MarsRover methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:14:00'! 237 | rotateRight 238 | 239 | head rotateRight: self! ! 240 | 241 | 242 | !MarsRover methodsFor: 'testing' stamp: 'HAW 8/22/2019 12:00:30'! 243 | isAt: aPosition heading: aCardinalPoint 244 | 245 | ^position = aPosition and: [ head isHeading: aCardinalPoint ]! ! 246 | 247 | !MarsRover methodsFor: 'testing' stamp: 'HAW 7/6/2018 18:16:51'! 248 | isBackwardCommand: aCommand 249 | 250 | ^aCommand = $b! ! 251 | 252 | !MarsRover methodsFor: 'testing' stamp: 'HAW 7/6/2018 18:16:19'! 253 | isForwardCommand: aCommand 254 | 255 | ^aCommand = $f ! ! 256 | 257 | !MarsRover methodsFor: 'testing' stamp: 'HAW 7/6/2018 18:17:51'! 258 | isRotateLeftCommand: aCommand 259 | 260 | ^aCommand = $l! ! 261 | 262 | !MarsRover methodsFor: 'testing' stamp: 'HAW 7/6/2018 18:17:21'! 263 | isRotateRightCommand: aCommand 264 | 265 | ^aCommand = $r! ! 266 | 267 | 268 | !MarsRover methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:05:20'! 269 | moveBackward 270 | 271 | head moveBackward: self! ! 272 | 273 | !MarsRover methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:15:01'! 274 | moveEast 275 | 276 | position := position + (1@0)! ! 277 | 278 | !MarsRover methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:05:55'! 279 | moveForward 280 | 281 | head moveForward: self! ! 282 | 283 | !MarsRover methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:13:12'! 284 | moveNorth 285 | 286 | position := position + (0@1)! ! 287 | 288 | !MarsRover methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:13:34'! 289 | moveSouth 290 | 291 | position := position + (0@-1)! ! 292 | 293 | !MarsRover methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:15:32'! 294 | moveWest 295 | 296 | position := position + (-1@0)! ! 297 | 298 | 299 | !MarsRover methodsFor: 'command processing' stamp: 'HAW 6/30/2018 19:48:26'! 300 | process: aSequenceOfCommands 301 | 302 | aSequenceOfCommands do: [:aCommand | self processCommand: aCommand ] 303 | ! ! 304 | 305 | !MarsRover methodsFor: 'command processing' stamp: 'HAW 8/22/2019 12:08:50'! 306 | processCommand: aCommand 307 | 308 | (self isForwardCommand: aCommand) ifTrue: [ ^ self moveForward ]. 309 | (self isBackwardCommand: aCommand) ifTrue: [ ^ self moveBackward ]. 310 | (self isRotateRightCommand: aCommand) ifTrue: [ ^ self rotateRight ]. 311 | (self isRotateLeftCommand: aCommand) ifTrue: [ ^ self rotateLeft ]. 312 | 313 | self signalInvalidCommand.! ! 314 | 315 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 316 | 317 | !classDefinition: 'MarsRover class' category: #'MarsRover-IS1-2Parcial-2c2019'! 318 | MarsRover class 319 | instanceVariableNames: 'headings'! 320 | 321 | !MarsRover class methodsFor: 'instance creation' stamp: 'HAW 8/22/2019 12:01:48'! 322 | at: aPosition heading: aCardinalPoint 323 | 324 | ^self new initializeAt: aPosition heading: (MarsRoverHeading heading: aCardinalPoint)! ! 325 | 326 | !MarsRover class methodsFor: 'instance creation' stamp: 'HAW 7/2/2018 16:26:14'! 327 | invalidCardinalPointErrorDescription 328 | 329 | ^'Invalid cardinal point'! ! 330 | 331 | 332 | !classDefinition: #MarsRoverHeading category: #'MarsRover-IS1-2Parcial-2c2019'! 333 | Object subclass: #MarsRoverHeading 334 | instanceVariableNames: '' 335 | classVariableNames: '' 336 | poolDictionaries: '' 337 | category: 'MarsRover-IS1-2Parcial-2c2019'! 338 | 339 | !MarsRoverHeading methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:06:17'! 340 | rotateLeft: aMarsRover 341 | 342 | self subclassResponsibility ! ! 343 | 344 | !MarsRoverHeading methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:08:23'! 345 | rotateRight: aMarsRover 346 | 347 | self subclassResponsibility ! ! 348 | 349 | 350 | !MarsRoverHeading methodsFor: 'testing' stamp: 'HAW 7/2/2018 19:07:42'! 351 | isHeading: aCardinalPoint 352 | 353 | ^self class isFor: aCardinalPoint! ! 354 | 355 | 356 | !MarsRoverHeading methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:05:20'! 357 | moveBackward: aMarsRover 358 | 359 | self subclassResponsibility ! ! 360 | 361 | !MarsRoverHeading methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:05:54'! 362 | moveForward: aMarsRover 363 | 364 | self subclassResponsibility ! ! 365 | 366 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 367 | 368 | !classDefinition: 'MarsRoverHeading class' category: #'MarsRover-IS1-2Parcial-2c2019'! 369 | MarsRoverHeading class 370 | instanceVariableNames: ''! 371 | 372 | !MarsRoverHeading class methodsFor: 'cardinal point' stamp: 'HAW 7/2/2018 19:07:01'! 373 | cardinalPoint 374 | 375 | self subclassResponsibility ! ! 376 | 377 | 378 | !MarsRoverHeading class methodsFor: 'instance creation' stamp: 'HAW 8/22/2019 12:02:00'! 379 | heading: aCardinalPoint 380 | 381 | ^self subclasses 382 | detect: [ :aMarsRoverPositionClass | aMarsRoverPositionClass isFor: aCardinalPoint ] 383 | ifFound: [ :aMarsRoverPositionClass | aMarsRoverPositionClass new ] 384 | ifNone: [ self error: MarsRover invalidCardinalPointErrorDescription ]! ! 385 | 386 | 387 | !MarsRoverHeading class methodsFor: 'testing' stamp: 'HAW 7/2/2018 17:01:33'! 388 | isFor: aCardinalPoint 389 | 390 | ^self cardinalPoint = aCardinalPoint ! ! 391 | 392 | 393 | !classDefinition: #MarsRoverHeadingEast category: #'MarsRover-IS1-2Parcial-2c2019'! 394 | MarsRoverHeading subclass: #MarsRoverHeadingEast 395 | instanceVariableNames: '' 396 | classVariableNames: '' 397 | poolDictionaries: '' 398 | category: 'MarsRover-IS1-2Parcial-2c2019'! 399 | 400 | !MarsRoverHeadingEast methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:09:19'! 401 | moveBackward: aMarsRover 402 | 403 | ^aMarsRover moveWest! ! 404 | 405 | !MarsRoverHeadingEast methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:09:28'! 406 | moveForward: aMarsRover 407 | 408 | ^aMarsRover moveEast! ! 409 | 410 | 411 | !MarsRoverHeadingEast methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:09:42'! 412 | rotateLeft: aMarsRover 413 | 414 | ^aMarsRover headNorth! ! 415 | 416 | !MarsRoverHeadingEast methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:09:54'! 417 | rotateRight: aMarsRover 418 | 419 | ^aMarsRover headSouth! ! 420 | 421 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 422 | 423 | !classDefinition: 'MarsRoverHeadingEast class' category: #'MarsRover-IS1-2Parcial-2c2019'! 424 | MarsRoverHeadingEast class 425 | instanceVariableNames: ''! 426 | 427 | !MarsRoverHeadingEast class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:01:53'! 428 | cardinalPoint 429 | 430 | ^#East! ! 431 | 432 | 433 | !classDefinition: #MarsRoverHeadingNorth category: #'MarsRover-IS1-2Parcial-2c2019'! 434 | MarsRoverHeading subclass: #MarsRoverHeadingNorth 435 | instanceVariableNames: '' 436 | classVariableNames: '' 437 | poolDictionaries: '' 438 | category: 'MarsRover-IS1-2Parcial-2c2019'! 439 | 440 | !MarsRoverHeadingNorth methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:10:12'! 441 | moveBackward: aMarsRover 442 | 443 | ^aMarsRover moveSouth! ! 444 | 445 | !MarsRoverHeadingNorth methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:10:23'! 446 | moveForward: aMarsRover 447 | 448 | ^aMarsRover moveNorth! ! 449 | 450 | 451 | !MarsRoverHeadingNorth methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:10:40'! 452 | rotateLeft: aMarsRover 453 | 454 | ^aMarsRover headWest! ! 455 | 456 | !MarsRoverHeadingNorth methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:10:51'! 457 | rotateRight: aMarsRover 458 | 459 | ^aMarsRover headEast! ! 460 | 461 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 462 | 463 | !classDefinition: 'MarsRoverHeadingNorth class' category: #'MarsRover-IS1-2Parcial-2c2019'! 464 | MarsRoverHeadingNorth class 465 | instanceVariableNames: ''! 466 | 467 | !MarsRoverHeadingNorth class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:03:11'! 468 | cardinalPoint 469 | 470 | ^#North! ! 471 | 472 | 473 | !classDefinition: #MarsRoverHeadingSouth category: #'MarsRover-IS1-2Parcial-2c2019'! 474 | MarsRoverHeading subclass: #MarsRoverHeadingSouth 475 | instanceVariableNames: '' 476 | classVariableNames: '' 477 | poolDictionaries: '' 478 | category: 'MarsRover-IS1-2Parcial-2c2019'! 479 | 480 | !MarsRoverHeadingSouth methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:11:15'! 481 | moveBackward: aMarsRover 482 | 483 | ^aMarsRover moveNorth! ! 484 | 485 | !MarsRoverHeadingSouth methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:11:25'! 486 | moveForward: aMarsRover 487 | 488 | ^aMarsRover moveSouth! ! 489 | 490 | 491 | !MarsRoverHeadingSouth methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:11:55'! 492 | rotateLeft: aMarsRover 493 | 494 | ^aMarsRover headEast! ! 495 | 496 | !MarsRoverHeadingSouth methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:11:50'! 497 | rotateRight: aMarsRover 498 | 499 | ^aMarsRover headWest! ! 500 | 501 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 502 | 503 | !classDefinition: 'MarsRoverHeadingSouth class' category: #'MarsRover-IS1-2Parcial-2c2019'! 504 | MarsRoverHeadingSouth class 505 | instanceVariableNames: ''! 506 | 507 | !MarsRoverHeadingSouth class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:03:17'! 508 | cardinalPoint 509 | 510 | ^#South! ! 511 | 512 | 513 | !classDefinition: #MarsRoverHeadingWest category: #'MarsRover-IS1-2Parcial-2c2019'! 514 | MarsRoverHeading subclass: #MarsRoverHeadingWest 515 | instanceVariableNames: '' 516 | classVariableNames: '' 517 | poolDictionaries: '' 518 | category: 'MarsRover-IS1-2Parcial-2c2019'! 519 | 520 | !MarsRoverHeadingWest methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:12:07'! 521 | moveBackward: aMarsRover 522 | 523 | ^aMarsRover moveEast! ! 524 | 525 | !MarsRoverHeadingWest methodsFor: 'moving' stamp: 'HAW 8/22/2019 12:12:15'! 526 | moveForward: aMarsRover 527 | 528 | ^aMarsRover moveWest! ! 529 | 530 | 531 | !MarsRoverHeadingWest methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:12:26'! 532 | rotateLeft: aMarsRover 533 | 534 | ^aMarsRover headSouth! ! 535 | 536 | !MarsRoverHeadingWest methodsFor: 'heading' stamp: 'HAW 8/22/2019 12:12:41'! 537 | rotateRight: aMarsRover 538 | 539 | ^aMarsRover headNorth! ! 540 | 541 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 542 | 543 | !classDefinition: 'MarsRoverHeadingWest class' category: #'MarsRover-IS1-2Parcial-2c2019'! 544 | MarsRoverHeadingWest class 545 | instanceVariableNames: ''! 546 | 547 | !MarsRoverHeadingWest class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:03:23'! 548 | cardinalPoint 549 | 550 | ^#West! ! 551 | -------------------------------------------------------------------------------- /2018-1c/MarsRover-With MarsRoverPosition Hierarchy.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #MarsRoverTest category: #'MarsRover-With MarsRoverPosition Hierarchy'! 2 | TestCase subclass: #MarsRoverTest 3 | instanceVariableNames: '' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: 'MarsRover-With MarsRoverPosition Hierarchy'! 7 | 8 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:26'! 9 | test01 10 | 11 | | marsRover | 12 | 13 | marsRover := MarsRover at: 1@2 heading: #North. 14 | 15 | marsRover process: ''. 16 | 17 | self assert: (marsRover isAt: 1@2 heading: #North)! ! 18 | 19 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:31'! 20 | test02 21 | 22 | | marsRover | 23 | 24 | marsRover := MarsRover at: 1@2 heading: #North. 25 | 26 | marsRover process: 'f'. 27 | 28 | self assert: (marsRover isAt: 1@3 heading: #North)! ! 29 | 30 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:34'! 31 | test03 32 | 33 | | marsRover | 34 | 35 | marsRover := MarsRover at: 1@2 heading: #North. 36 | 37 | marsRover process: 'b'. 38 | 39 | self assert: (marsRover isAt: 1@1 heading: #North)! ! 40 | 41 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:38'! 42 | test04 43 | 44 | | marsRover | 45 | 46 | marsRover := MarsRover at: 1@2 heading: #North. 47 | 48 | marsRover process: 'r'. 49 | 50 | self assert: (marsRover isAt: 1@2 heading: #East)! ! 51 | 52 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:45'! 53 | test05 54 | 55 | | marsRover | 56 | 57 | marsRover := MarsRover at: 1@2 heading: #North. 58 | 59 | marsRover process: 'l'. 60 | 61 | self assert: (marsRover isAt: 1@2 heading: #West)! ! 62 | 63 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:50'! 64 | test06 65 | 66 | | marsRover | 67 | 68 | marsRover := MarsRover at: 1@2 heading: #North. 69 | 70 | self 71 | should: [ marsRover process: 'x' ] 72 | raise: Error - MessageNotUnderstood 73 | withExceptionDo: [ :anError | 74 | self assert: anError messageText equals: marsRover invalidCommandErrorDescription. 75 | self assert: (marsRover isAt: 1@2 heading: #North) ]! ! 76 | 77 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:54'! 78 | test07 79 | 80 | | marsRover | 81 | 82 | marsRover := MarsRover at: 1@2 heading: #North. 83 | 84 | marsRover process: 'ff'. 85 | 86 | self assert: (marsRover isAt: 1@4 heading: #North)! ! 87 | 88 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:23:59'! 89 | test08 90 | 91 | | marsRover | 92 | 93 | marsRover := MarsRover at: 1@2 heading: #East. 94 | 95 | marsRover process: 'f'. 96 | 97 | self assert: (marsRover isAt: 2@2 heading: #East)! ! 98 | 99 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:06'! 100 | test09 101 | 102 | | marsRover | 103 | 104 | marsRover := MarsRover at: 1@2 heading: #East. 105 | 106 | marsRover process: 'b'. 107 | 108 | self assert: (marsRover isAt: 0@2 heading: #East)! ! 109 | 110 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:12'! 111 | test10 112 | 113 | | marsRover | 114 | 115 | marsRover := MarsRover at: 1@2 heading: #East. 116 | 117 | marsRover process: 'r'. 118 | 119 | self assert: (marsRover isAt: 1@2 heading: #South)! ! 120 | 121 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:20'! 122 | test11 123 | 124 | | marsRover | 125 | 126 | marsRover := MarsRover at: 1@2 heading: #East. 127 | 128 | marsRover process: 'l'. 129 | 130 | self assert: (marsRover isAt: 1@2 heading: #North)! ! 131 | 132 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:25'! 133 | test12 134 | 135 | | marsRover | 136 | 137 | marsRover := MarsRover at: 1@2 heading: #South. 138 | 139 | marsRover process: 'ffbr'. 140 | 141 | self assert: (marsRover isAt: 1@1 heading: #West)! ! 142 | 143 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:29'! 144 | test13 145 | 146 | | marsRover | 147 | 148 | marsRover := MarsRover at: 1@2 heading: #South. 149 | 150 | marsRover process: 'l'. 151 | 152 | self assert: (marsRover isAt: 1@2 heading: #East)! ! 153 | 154 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:33'! 155 | test14 156 | 157 | | marsRover | 158 | 159 | marsRover := MarsRover at: 1@2 heading: #West. 160 | 161 | marsRover process: 'ffbr'. 162 | 163 | self assert: (marsRover isAt: 0@2 heading: #North)! ! 164 | 165 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/1/2018 14:24:37'! 166 | test15 167 | 168 | | marsRover | 169 | 170 | marsRover := MarsRover at: 1@2 heading: #West. 171 | 172 | marsRover process: 'l'. 173 | 174 | self assert: (marsRover isAt: 1@2 heading: #South)! ! 175 | 176 | !MarsRoverTest methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 16:27:43'! 177 | test16 178 | 179 | self 180 | should: [MarsRover at: 1@2 heading: #X ] 181 | raise: Error 182 | withExceptionDo: [:anError | 183 | self assert: MarsRover invalidCardinalPointErrorDescription equals: anError messageText ]! ! 184 | 185 | 186 | !classDefinition: #MarsRover category: #'MarsRover-With MarsRoverPosition Hierarchy'! 187 | Object subclass: #MarsRover 188 | instanceVariableNames: 'position' 189 | classVariableNames: '' 190 | poolDictionaries: '' 191 | category: 'MarsRover-With MarsRoverPosition Hierarchy'! 192 | 193 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:05:48'! 194 | initializeAt: aMarsRoverPositionHeading 195 | 196 | position := aMarsRoverPositionHeading ! ! 197 | 198 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 6/30/2018 19:48:45'! 199 | invalidCommandErrorDescription 200 | 201 | ^'Invalid command'! ! 202 | 203 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:07:53'! 204 | isAt: aPosition heading: aCardinalPoint 205 | 206 | ^position isAt: aPosition heading: aCardinalPoint ! ! 207 | 208 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:16:51'! 209 | isBackwardCommand: aCommand 210 | 211 | ^aCommand = $b! ! 212 | 213 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:16:19'! 214 | isForwardCommand: aCommand 215 | 216 | ^aCommand = $f ! ! 217 | 218 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:17:51'! 219 | isRotateLeftCommand: aCommand 220 | 221 | ^aCommand = $l! ! 222 | 223 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:17:21'! 224 | isRotateRightCommand: aCommand 225 | 226 | ^aCommand = $r! ! 227 | 228 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:23:09'! 229 | moveBackward 230 | 231 | position := position backward! ! 232 | 233 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:22:54'! 234 | moveForward 235 | 236 | position := position forward! ! 237 | 238 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 6/30/2018 19:48:26'! 239 | process: aSequenceOfCommands 240 | 241 | aSequenceOfCommands do: [:aCommand | self processCommand: aCommand ] 242 | ! ! 243 | 244 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:19:33'! 245 | processCommand: aCommand 246 | 247 | (self isForwardCommand: aCommand) ifTrue: [ ^ self moveForward ]. 248 | (self isBackwardCommand: aCommand) ifTrue: [ ^ self moveBackward ]. 249 | (self isRotateRightCommand: aCommand) ifTrue: [ ^ self rotateRight ]. 250 | (self isRotateLeftCommand: aCommand) ifTrue: [ ^ self rotateLeft ]. 251 | 252 | self signalInvalidCommand.! ! 253 | 254 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:26:11'! 255 | rotateLeft 256 | 257 | position := position rotateLeft! ! 258 | 259 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:25:38'! 260 | rotateRight 261 | 262 | position := position rotateRight! ! 263 | 264 | !MarsRover methodsFor: 'as yet unclassified' stamp: 'HAW 6/30/2018 19:50:26'! 265 | signalInvalidCommand 266 | 267 | self error: self invalidCommandErrorDescription ! ! 268 | 269 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 270 | 271 | !classDefinition: 'MarsRover class' category: #'MarsRover-With MarsRoverPosition Hierarchy'! 272 | MarsRover class 273 | instanceVariableNames: 'headings'! 274 | 275 | !MarsRover class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 16:56:54'! 276 | at: aPosition heading: aCardinalPoint 277 | 278 | ^self new initializeAt: (MarsRoverPosition at: aPosition heading: aCardinalPoint)! ! 279 | 280 | !MarsRover class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 16:26:14'! 281 | invalidCardinalPointErrorDescription 282 | 283 | ^'Invalid cardinal point'! ! 284 | 285 | 286 | !classDefinition: #MarsRoverPosition category: #'MarsRover-With MarsRoverPosition Hierarchy'! 287 | Object subclass: #MarsRoverPosition 288 | instanceVariableNames: 'position' 289 | classVariableNames: '' 290 | poolDictionaries: '' 291 | category: 'MarsRover-With MarsRoverPosition Hierarchy'! 292 | 293 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:08:17'! 294 | backward 295 | 296 | self subclassResponsibility ! ! 297 | 298 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:08:06'! 299 | forward 300 | 301 | self subclassResponsibility ! ! 302 | 303 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:05:19'! 304 | initializeAt: aPosition 305 | 306 | position := aPosition ! ! 307 | 308 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:07:28'! 309 | isAt: aPosition heading: aCardinalPoint 310 | 311 | ^position = aPosition and: [ self isHeading: aCardinalPoint ]! ! 312 | 313 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:07:42'! 314 | isHeading: aCardinalPoint 315 | 316 | ^self class isFor: aCardinalPoint! ! 317 | 318 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 18:39:39'! 319 | newAt: aPosition 320 | 321 | ^self class newAt: aPosition ! ! 322 | 323 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:08:21'! 324 | rotateLeft 325 | 326 | self subclassResponsibility ! ! 327 | 328 | !MarsRoverPosition methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:08:23'! 329 | rotateRight 330 | 331 | self subclassResponsibility ! ! 332 | 333 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 334 | 335 | !classDefinition: 'MarsRoverPosition class' category: #'MarsRover-With MarsRoverPosition Hierarchy'! 336 | MarsRoverPosition class 337 | instanceVariableNames: ''! 338 | 339 | !MarsRoverPosition class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:05:47'! 340 | at: aPosition heading: aCardinalPoint 341 | 342 | ^self subclasses 343 | detect: [ :aMarsRoverPositionClass | aMarsRoverPositionClass isFor: aCardinalPoint ] 344 | ifFound: [ :aMarsRoverPositionClass | aMarsRoverPositionClass newAt: aPosition ] 345 | ifNone: [ self error: MarsRover invalidCardinalPointErrorDescription ]! ! 346 | 347 | !MarsRoverPosition class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:07:01'! 348 | cardinalPoint 349 | 350 | self subclassResponsibility ! ! 351 | 352 | !MarsRoverPosition class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:01:33'! 353 | isFor: aCardinalPoint 354 | 355 | ^self cardinalPoint = aCardinalPoint ! ! 356 | 357 | !MarsRoverPosition class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:05:05'! 358 | newAt: aPosition 359 | 360 | ^self new initializeAt: aPosition ! ! 361 | 362 | 363 | !classDefinition: #MarsRoverPositionHeadingEast category: #'MarsRover-With MarsRoverPosition Hierarchy'! 364 | MarsRoverPosition subclass: #MarsRoverPositionHeadingEast 365 | instanceVariableNames: '' 366 | classVariableNames: '' 367 | poolDictionaries: '' 368 | category: 'MarsRover-With MarsRoverPosition Hierarchy'! 369 | 370 | !MarsRoverPositionHeadingEast methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 18:43:13'! 371 | backward 372 | 373 | ^self newAt: position + (-1@0)! ! 374 | 375 | !MarsRoverPositionHeadingEast methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 18:41:12'! 376 | forward 377 | 378 | ^self newAt: position + (1@0)! ! 379 | 380 | !MarsRoverPositionHeadingEast methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:25:49'! 381 | rotateLeft 382 | 383 | ^MarsRoverPositionHeadingNorth newAt: position ! ! 384 | 385 | !MarsRoverPositionHeadingEast methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:25:20'! 386 | rotateRight 387 | 388 | ^MarsRoverPositionHeadingSouth newAt: position ! ! 389 | 390 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 391 | 392 | !classDefinition: 'MarsRoverPositionHeadingEast class' category: #'MarsRover-With MarsRoverPosition Hierarchy'! 393 | MarsRoverPositionHeadingEast class 394 | instanceVariableNames: ''! 395 | 396 | !MarsRoverPositionHeadingEast class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:01:53'! 397 | cardinalPoint 398 | 399 | ^#East! ! 400 | 401 | 402 | !classDefinition: #MarsRoverPositionHeadingNorth category: #'MarsRover-With MarsRoverPosition Hierarchy'! 403 | MarsRoverPosition subclass: #MarsRoverPositionHeadingNorth 404 | instanceVariableNames: '' 405 | classVariableNames: '' 406 | poolDictionaries: '' 407 | category: 'MarsRover-With MarsRoverPosition Hierarchy'! 408 | 409 | !MarsRoverPositionHeadingNorth methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 18:40:01'! 410 | backward 411 | 412 | ^self newAt: position + (0@-1)! ! 413 | 414 | !MarsRoverPositionHeadingNorth methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 18:38:33'! 415 | forward 416 | 417 | ^self newAt: position + (0@1)! ! 418 | 419 | !MarsRoverPositionHeadingNorth methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:25:58'! 420 | rotateLeft 421 | 422 | ^MarsRoverPositionHeadingWest newAt: position ! ! 423 | 424 | !MarsRoverPositionHeadingNorth methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:25:23'! 425 | rotateRight 426 | 427 | ^MarsRoverPositionHeadingEast newAt: position ! ! 428 | 429 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 430 | 431 | !classDefinition: 'MarsRoverPositionHeadingNorth class' category: #'MarsRover-With MarsRoverPosition Hierarchy'! 432 | MarsRoverPositionHeadingNorth class 433 | instanceVariableNames: ''! 434 | 435 | !MarsRoverPositionHeadingNorth class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:03:11'! 436 | cardinalPoint 437 | 438 | ^#North! ! 439 | 440 | 441 | !classDefinition: #MarsRoverPositionHeadingSouth category: #'MarsRover-With MarsRoverPosition Hierarchy'! 442 | MarsRoverPosition subclass: #MarsRoverPositionHeadingSouth 443 | instanceVariableNames: '' 444 | classVariableNames: '' 445 | poolDictionaries: '' 446 | category: 'MarsRover-With MarsRoverPosition Hierarchy'! 447 | 448 | !MarsRoverPositionHeadingSouth methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 18:59:07'! 449 | backward 450 | 451 | ^self newAt: position + (0@1)! ! 452 | 453 | !MarsRoverPositionHeadingSouth methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 18:46:20'! 454 | forward 455 | 456 | ^self newAt: position +(0@-1)! ! 457 | 458 | !MarsRoverPositionHeadingSouth methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:26:02'! 459 | rotateLeft 460 | 461 | ^MarsRoverPositionHeadingEast newAt: position ! ! 462 | 463 | !MarsRoverPositionHeadingSouth methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:25:26'! 464 | rotateRight 465 | 466 | ^MarsRoverPositionHeadingWest newAt: position ! ! 467 | 468 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 469 | 470 | !classDefinition: 'MarsRoverPositionHeadingSouth class' category: #'MarsRover-With MarsRoverPosition Hierarchy'! 471 | MarsRoverPositionHeadingSouth class 472 | instanceVariableNames: ''! 473 | 474 | !MarsRoverPositionHeadingSouth class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:03:17'! 475 | cardinalPoint 476 | 477 | ^#South! ! 478 | 479 | 480 | !classDefinition: #MarsRoverPositionHeadingWest category: #'MarsRover-With MarsRoverPosition Hierarchy'! 481 | MarsRoverPosition subclass: #MarsRoverPositionHeadingWest 482 | instanceVariableNames: '' 483 | classVariableNames: '' 484 | poolDictionaries: '' 485 | category: 'MarsRover-With MarsRoverPosition Hierarchy'! 486 | 487 | !MarsRoverPositionHeadingWest methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:00:25'! 488 | backward 489 | 490 | ^self newAt: position + (1@0)! ! 491 | 492 | !MarsRoverPositionHeadingWest methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 19:00:06'! 493 | forward 494 | 495 | ^self newAt: position + (-1@0)! ! 496 | 497 | !MarsRoverPositionHeadingWest methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:26:05'! 498 | rotateLeft 499 | 500 | ^MarsRoverPositionHeadingSouth newAt: position ! ! 501 | 502 | !MarsRoverPositionHeadingWest methodsFor: 'as yet unclassified' stamp: 'HAW 7/6/2018 18:25:29'! 503 | rotateRight 504 | 505 | ^MarsRoverPositionHeadingNorth newAt: position ! ! 506 | 507 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 508 | 509 | !classDefinition: 'MarsRoverPositionHeadingWest class' category: #'MarsRover-With MarsRoverPosition Hierarchy'! 510 | MarsRoverPositionHeadingWest class 511 | instanceVariableNames: ''! 512 | 513 | !MarsRoverPositionHeadingWest class methodsFor: 'as yet unclassified' stamp: 'HAW 7/2/2018 17:03:23'! 514 | cardinalPoint 515 | 516 | ^#West! ! 517 | -------------------------------------------------------------------------------- /2019-2c/1erParcial/IngSof1-2019-2C-1Parcial.st: -------------------------------------------------------------------------------- 1 | !classDefinition: #CoffeeShopTest category: #'IngSof1-2019-2C-1Parcial'! 2 | TestCase subclass: #CoffeeShopTest 3 | instanceVariableNames: 'billGates adaLovelace alanKay salesSystem' 4 | classVariableNames: '' 5 | poolDictionaries: '' 6 | category: 'IngSof1-2019-2C-1Parcial'! 7 | 8 | !CoffeeShopTest methodsFor: 'setUp/tearDown' stamp: 'HAW 9/22/2019 21:41:38'! 9 | setUp 10 | 11 | adaLovelace := CoffeeShopCustomer named: 'Ada Lovelace' ofType: #Gold. 12 | alanKay := CoffeeShopCustomer named: 'Alan Kay' ofType: #Silver. 13 | billGates := CoffeeShopCustomer named: 'Bill Gates' ofType: #Normal! ! 14 | 15 | 16 | !CoffeeShopTest methodsFor: 'test objects' stamp: 'HAW 9/20/2019 17:15:53'! 17 | combo1 18 | 19 | ^#Combo1! ! 20 | 21 | !CoffeeShopTest methodsFor: 'test objects' stamp: 'HAW 9/20/2019 17:21:01'! 22 | combo2 23 | 24 | ^#Combo2! ! 25 | 26 | 27 | !CoffeeShopTest methodsFor: 'tests - sales' stamp: 'HAW 9/22/2019 21:41:51'! 28 | test01ThereAreNoSalesWhenSalesSystemIsCreated 29 | 30 | salesSystem := CoffeeShopSalesSystem new. 31 | 32 | self assert: (salesSystem salesMadeTo: adaLovelace) isEmpty! ! 33 | 34 | !CoffeeShopTest methodsFor: 'tests - sales' stamp: 'HAW 9/22/2019 21:41:51'! 35 | test02CanQuerySalesByCustomer 36 | 37 | | salesToAdaLovelace | 38 | 39 | salesSystem := CoffeeShopSalesSystem new. 40 | 41 | salesSystem registerSaleTo: adaLovelace of: self combo1. 42 | 43 | salesToAdaLovelace := salesSystem salesMadeTo: adaLovelace. 44 | self assert: 1 equals: salesToAdaLovelace size. 45 | self assert: 1 equals: (salesToAdaLovelace count: [ :aProduct | aProduct = self combo1 ])! ! 46 | 47 | !CoffeeShopTest methodsFor: 'tests - sales' stamp: 'HAW 9/22/2019 21:41:51'! 48 | test03SalesAreDistinguishedByCustomer 49 | 50 | | salesToAdaLovelace salesToAlanKay | 51 | 52 | salesSystem := CoffeeShopSalesSystem new. 53 | 54 | salesSystem registerSaleTo: adaLovelace of: self combo1. 55 | salesSystem registerSaleTo: alanKay of: self combo2. 56 | 57 | salesToAdaLovelace := salesSystem salesMadeTo: adaLovelace. 58 | self assert: 1 equals: salesToAdaLovelace size. 59 | self assert: 1 equals: (salesToAdaLovelace count: [ :aProduct | aProduct = self combo1 ]). 60 | 61 | salesToAlanKay := salesSystem salesMadeTo: alanKay. 62 | self assert: 1 equals: salesToAlanKay size. 63 | self assert: 1 equals: (salesToAlanKay count: [ :aProduct | aProduct = self combo2 ])! ! 64 | 65 | 66 | !CoffeeShopTest methodsFor: 'tests - volume sold' stamp: 'HAW 9/22/2019 21:41:51'! 67 | test04VolumeSoldToCustomerIsZeroWhenCustomerHasNoSaleRegistered 68 | 69 | | volumeSoldToCustomer | 70 | 71 | salesSystem := CoffeeShopSalesSystem new. 72 | 73 | volumeSoldToCustomer := salesSystem volumeSoldTo: adaLovelace. 74 | 75 | self assert: 0*milliliter equals: volumeSoldToCustomer! ! 76 | 77 | !CoffeeShopTest methodsFor: 'tests - volume sold' stamp: 'HAW 9/22/2019 21:46:19'! 78 | test05VolumeIs_250_WhenOnlyCombo1WasSoldToCustomer 79 | 80 | | volumeSoldToCustomer | 81 | 82 | salesSystem := CoffeeShopSalesSystem new. 83 | 84 | salesSystem registerSaleTo: adaLovelace of: self combo1. 85 | 86 | volumeSoldToCustomer := salesSystem volumeSoldTo: adaLovelace. 87 | 88 | self assert: 250*milliliter equals: volumeSoldToCustomer ! ! 89 | 90 | !CoffeeShopTest methodsFor: 'tests - volume sold' stamp: 'HAW 9/22/2019 21:46:07'! 91 | test06VolumeIs_100_WhenOnlyCombo2WasSoldToCustomer 92 | 93 | | volumeSoldToCustomer | 94 | 95 | salesSystem := CoffeeShopSalesSystem new. 96 | 97 | salesSystem registerSaleTo: adaLovelace of: self combo2. 98 | 99 | volumeSoldToCustomer := salesSystem volumeSoldTo: adaLovelace. 100 | 101 | self assert: 100*milliliter equals: volumeSoldToCustomer ! ! 102 | 103 | !CoffeeShopTest methodsFor: 'tests - volume sold' stamp: 'HAW 9/22/2019 21:46:41'! 104 | test07VolumeSoldToCustomerIsTheSumOfAllSoldProducts 105 | 106 | | volumeSoldToCustomer | 107 | 108 | salesSystem := CoffeeShopSalesSystem new. 109 | 110 | salesSystem registerSaleTo: adaLovelace of: self combo1. 111 | salesSystem registerSaleTo: adaLovelace of: self combo2. 112 | 113 | volumeSoldToCustomer := salesSystem volumeSoldTo: adaLovelace. 114 | 115 | self assert: (250*milliliter)+(100*milliliter) equals: volumeSoldToCustomer ! ! 116 | 117 | 118 | !CoffeeShopTest methodsFor: 'tests - rewards' stamp: 'HAW 9/22/2019 21:48:39'! 119 | test08NoRewardExpectedWhenCustomerHasNotBuyAnything 120 | 121 | salesSystem := CoffeeShopSalesSystem new. 122 | 123 | salesSystem rewardOf: adaLovelace ifNone: [ ^self ]. 124 | 125 | self failWith: 'No reward expected when customer has not buy anything'! ! 126 | 127 | !CoffeeShopTest methodsFor: 'tests - rewards' stamp: 'HAW 9/22/2019 21:41:51'! 128 | test09GoldCustomerGetsRewardedWithOneCombo2With50PercentItsPriceWhenRule1Holds 129 | 130 | | adaLovelaceReward | 131 | 132 | salesSystem := CoffeeShopSalesSystem new. 133 | 134 | salesSystem registerSaleTo: adaLovelace of: self combo1. 135 | salesSystem registerSaleTo: adaLovelace of: self combo2. 136 | 137 | adaLovelaceReward := salesSystem rewardOf: adaLovelace ifNone: [ self fail ]. 138 | 139 | self assert: 1 equals: adaLovelaceReward quantity. 140 | self assert: adaLovelaceReward isForCombo2. 141 | self assert: 60*peso equals: adaLovelaceReward price. 142 | ! ! 143 | 144 | !CoffeeShopTest methodsFor: 'tests - rewards' stamp: 'HAW 9/22/2019 21:41:51'! 145 | test10SilverCustomerGetsRewardedWithOneCombo2With75PercentItsPriceWhenRule1Holds 146 | 147 | | alaKayReward | 148 | 149 | salesSystem := CoffeeShopSalesSystem new. 150 | 151 | salesSystem registerSaleTo: alanKay of: self combo1. 152 | salesSystem registerSaleTo: alanKay of: self combo2. 153 | 154 | alaKayReward := salesSystem rewardOf: alanKay ifNone: [ self fail ]. 155 | 156 | self assert: 1 equals: alaKayReward quantity. 157 | self assert: alaKayReward isForCombo2. 158 | self assert: 120*3/4*peso equals: alaKayReward price. 159 | ! ! 160 | 161 | !CoffeeShopTest methodsFor: 'tests - rewards' stamp: 'HAW 9/22/2019 21:41:51'! 162 | test11NormalCustomerGetsRewardedWithOneCombo2With90PercentItsPriceWhenRule1Holds 163 | 164 | | billGatesReward | 165 | 166 | salesSystem := CoffeeShopSalesSystem new. 167 | 168 | salesSystem registerSaleTo: billGates of: self combo1. 169 | salesSystem registerSaleTo: billGates of: self combo2. 170 | 171 | billGatesReward := salesSystem rewardOf: billGates ifNone: [ self fail ]. 172 | 173 | self assert: 1 equals: billGatesReward quantity. 174 | self assert: billGatesReward isForCombo2. 175 | self assert: 120*9/10*peso equals: billGatesReward price. 176 | ! ! 177 | 178 | !CoffeeShopTest methodsFor: 'tests - rewards' stamp: 'HAW 9/22/2019 21:41:51'! 179 | test12GoldCustomerGetsRewardedWithOneCombo1At75PesosWhenRule2Holds 180 | 181 | | adaLovelaceReward | 182 | 183 | salesSystem := CoffeeShopSalesSystem new. 184 | 185 | salesSystem registerSaleTo: adaLovelace of: self combo1. 186 | salesSystem registerSaleTo: adaLovelace of: self combo1. 187 | salesSystem registerSaleTo: adaLovelace of: self combo2. 188 | 189 | adaLovelaceReward := salesSystem rewardOf: adaLovelace ifNone: [ self fail ]. 190 | 191 | self assert: 2 equals: adaLovelaceReward quantity. 192 | self assert: adaLovelaceReward isForCombo1. 193 | self assert: 75*peso equals: adaLovelaceReward price. 194 | ! ! 195 | 196 | !CoffeeShopTest methodsFor: 'tests - rewards' stamp: 'HAW 9/22/2019 21:41:51'! 197 | test13SilverCustomerGetsRewardedWithOneCombo1At83PesosWhenRule2Holds 198 | 199 | | alanKayReward | 200 | 201 | salesSystem := CoffeeShopSalesSystem new. 202 | 203 | salesSystem registerSaleTo: alanKay of: self combo1. 204 | salesSystem registerSaleTo: alanKay of: self combo1. 205 | salesSystem registerSaleTo: alanKay of: self combo2. 206 | 207 | alanKayReward := salesSystem rewardOf: alanKay ifNone: [ self fail ]. 208 | 209 | self assert: 2 equals: alanKayReward quantity. 210 | self assert: alanKayReward isForCombo1. 211 | self assert: 83*peso equals: alanKayReward price. 212 | ! ! 213 | 214 | !CoffeeShopTest methodsFor: 'tests - rewards' stamp: 'HAW 9/22/2019 21:41:51'! 215 | test14NormalCustomerGetsRewardedWithOneCombo1At97PesosWhenRule2Holds 216 | 217 | | billGatesReward | 218 | 219 | salesSystem := CoffeeShopSalesSystem new. 220 | 221 | salesSystem registerSaleTo: billGates of: self combo1. 222 | salesSystem registerSaleTo: billGates of: self combo1. 223 | salesSystem registerSaleTo: billGates of: self combo2. 224 | 225 | billGatesReward := salesSystem rewardOf: billGates ifNone: [ self fail ]. 226 | 227 | self assert: 2 equals: billGatesReward quantity. 228 | self assert: billGatesReward isForCombo1. 229 | self assert: 97*peso equals: billGatesReward price. 230 | ! ! 231 | 232 | 233 | !classDefinition: #CoffeeShopCustomer category: #'IngSof1-2019-2C-1Parcial'! 234 | Object subclass: #CoffeeShopCustomer 235 | instanceVariableNames: 'name type' 236 | classVariableNames: '' 237 | poolDictionaries: '' 238 | category: 'IngSof1-2019-2C-1Parcial'! 239 | 240 | !CoffeeShopCustomer methodsFor: 'type' stamp: 'HAW 9/21/2019 13:05:10'! 241 | type 242 | 243 | ^type! ! 244 | 245 | 246 | !CoffeeShopCustomer methodsFor: 'initialization' stamp: 'HAW 9/21/2019 13:00:45'! 247 | initializeNamed: aName ofType: aType 248 | 249 | name := aName. 250 | type := aType ! ! 251 | 252 | 253 | !CoffeeShopCustomer methodsFor: 'printing' stamp: 'HAW 9/22/2019 18:57:07'! 254 | printOn: aStream 255 | 256 | aStream 257 | nextPutAll: 'Customer named '; 258 | nextPutAll: name! ! 259 | 260 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 261 | 262 | !classDefinition: 'CoffeeShopCustomer class' category: #'IngSof1-2019-2C-1Parcial'! 263 | CoffeeShopCustomer class 264 | instanceVariableNames: ''! 265 | 266 | !CoffeeShopCustomer class methodsFor: 'instance creation' stamp: 'HAW 9/21/2019 13:00:21'! 267 | named: aName ofType: aType 268 | 269 | ^self new initializeNamed: aName ofType: aType! ! 270 | 271 | 272 | !classDefinition: #CoffeeShopReward category: #'IngSof1-2019-2C-1Parcial'! 273 | Object subclass: #CoffeeShopReward 274 | instanceVariableNames: 'price quantity product' 275 | classVariableNames: '' 276 | poolDictionaries: '' 277 | category: 'IngSof1-2019-2C-1Parcial'! 278 | 279 | !CoffeeShopReward methodsFor: 'accessing' stamp: 'HAW 9/20/2019 17:54:42'! 280 | price 281 | 282 | ^price! ! 283 | 284 | !CoffeeShopReward methodsFor: 'accessing' stamp: 'HAW 9/21/2019 16:31:13'! 285 | quantity 286 | 287 | ^quantity ! ! 288 | 289 | 290 | !CoffeeShopReward methodsFor: 'initialization' stamp: 'HAW 9/22/2019 19:08:08'! 291 | initializeOf: aProduct at: aPrice quantity: aQuantity 292 | 293 | product := aProduct. 294 | price := aPrice. 295 | quantity := aQuantity 296 | ! ! 297 | 298 | 299 | !CoffeeShopReward methodsFor: 'testing' stamp: 'HAW 9/22/2019 19:07:57'! 300 | isForCombo1 301 | 302 | ^product = #Combo1! ! 303 | 304 | !CoffeeShopReward methodsFor: 'testing' stamp: 'HAW 9/22/2019 19:07:57'! 305 | isForCombo2 306 | 307 | ^product = #Combo2! ! 308 | 309 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 310 | 311 | !classDefinition: 'CoffeeShopReward class' category: #'IngSof1-2019-2C-1Parcial'! 312 | CoffeeShopReward class 313 | instanceVariableNames: ''! 314 | 315 | !CoffeeShopReward class methodsFor: 'instance creation' stamp: 'HAW 9/20/2019 17:53:14'! 316 | of: aComboType at: aPrice quantity: aQuantity 317 | 318 | ^self new initializeOf: aComboType at: aPrice quantity: aQuantity 319 | ! ! 320 | 321 | 322 | !classDefinition: #CoffeeShopSalesSystem category: #'IngSof1-2019-2C-1Parcial'! 323 | Object subclass: #CoffeeShopSalesSystem 324 | instanceVariableNames: 'sales' 325 | classVariableNames: '' 326 | poolDictionaries: '' 327 | category: 'IngSof1-2019-2C-1Parcial'! 328 | 329 | !CoffeeShopSalesSystem methodsFor: 'product volume' stamp: 'HAW 9/22/2019 19:51:19'! 330 | volumeOf: aProduct 331 | 332 | aProduct = #Combo1 ifTrue: [ ^250*milliliter ]. 333 | aProduct = #Combo2 ifTrue: [ ^100*milliliter ]. 334 | 335 | self error: 'Invalid product' 336 | ! ! 337 | 338 | 339 | !CoffeeShopSalesSystem methodsFor: 'initialization' stamp: 'HAW 9/20/2019 17:17:34'! 340 | initialize 341 | 342 | sales := Dictionary new! ! 343 | 344 | 345 | !CoffeeShopSalesSystem methodsFor: 'selling' stamp: 'HAW 9/22/2019 19:06:50'! 346 | registerSaleTo: aCustomer of: aProduct 347 | 348 | | salesToCustomer | 349 | 350 | salesToCustomer := sales at: aCustomer ifAbsentPut: [ OrderedCollection new ]. 351 | salesToCustomer add: aProduct ! ! 352 | 353 | !CoffeeShopSalesSystem methodsFor: 'selling' stamp: 'HAW 9/20/2019 17:24:49'! 354 | salesMadeTo: aCustomer 355 | 356 | ^sales at: aCustomer ifAbsent: [ #() ]! ! 357 | 358 | !CoffeeShopSalesSystem methodsFor: 'selling' stamp: 'HAW 9/22/2019 19:51:19'! 359 | volumeSoldTo: aCustomer 360 | 361 | ^(self salesMadeTo: aCustomer) sum: [ :aProduct | self volumeOf: aProduct ] ifEmpty: [ 0*milliliter ]! ! 362 | 363 | 364 | !CoffeeShopSalesSystem methodsFor: 'rewarding' stamp: 'HAW 9/22/2019 19:53:42'! 365 | rewardOf: aCustomer ifNone: noneBlock 366 | 367 | | salesToCustomer volumeSoldToCustomer rewardRule | 368 | 369 | salesToCustomer := self salesMadeTo: aCustomer. 370 | volumeSoldToCustomer := self volumeSoldTo: aCustomer. 371 | 372 | rewardRule := RewardRule for: volumeSoldToCustomer ifNone: [^noneBlock value]. 373 | ^rewardRule createRewardFor: aCustomer. 374 | ! ! 375 | 376 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 377 | 378 | !classDefinition: 'CoffeeShopSalesSystem class' category: #'IngSof1-2019-2C-1Parcial'! 379 | CoffeeShopSalesSystem class 380 | instanceVariableNames: ''! 381 | 382 | !CoffeeShopSalesSystem class methodsFor: 'initialization' stamp: 'HAW 9/23/2019 08:50:03'! 383 | initialize 384 | 385 | Smalltalk at: #milliliter put: (BaseUnit named: 'milliliter')! ! 386 | 387 | 388 | !classDefinition: #RewardRule category: #'IngSof1-2019-2C-1Parcial'! 389 | Object subclass: #RewardRule 390 | instanceVariableNames: 'product' 391 | classVariableNames: '' 392 | poolDictionaries: '' 393 | category: 'IngSof1-2019-2C-1Parcial'! 394 | 395 | !RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 19:03:50'! 396 | createRewardFor: aCustomer 397 | 398 | self subclassResponsibility ! ! 399 | 400 | !RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 10:51:26'! 401 | productQuantity 402 | 403 | self subclassResponsibility ! ! 404 | 405 | !RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 10:51:33'! 406 | rewardedProduct 407 | 408 | self subclassResponsibility ! ! 409 | 410 | 411 | !RewardRule methodsFor: 'product price' stamp: 'HAW 9/22/2019 21:43:12'! 412 | priceOf: aProduct 413 | 414 | aProduct = #Combo1 ifTrue: [ ^150*peso ]. 415 | aProduct = #Combo2 ifTrue: [ ^120*peso ]. 416 | 417 | self error: 'Invalid combo type'! ! 418 | 419 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 420 | 421 | !classDefinition: 'RewardRule class' category: #'IngSof1-2019-2C-1Parcial'! 422 | RewardRule class 423 | instanceVariableNames: ''! 424 | 425 | !RewardRule class methodsFor: 'testing' stamp: 'HAW 9/22/2019 19:53:22'! 426 | isFor: volumeSoldToCustomer 427 | 428 | self subclassResponsibility ! ! 429 | 430 | 431 | !RewardRule class methodsFor: 'instance creation' stamp: 'HAW 9/22/2019 19:53:42'! 432 | for: volumeSoldToCustomer ifNone: aNoneBlock 433 | 434 | ^self subclasses 435 | detect: [ :aRuleClass | aRuleClass isFor: volumeSoldToCustomer ] 436 | ifFound: [ :aRuleClass | aRuleClass new ] 437 | ifNone: aNoneBlock ! ! 438 | 439 | 440 | !classDefinition: #Combo1RewardRule category: #'IngSof1-2019-2C-1Parcial'! 441 | RewardRule subclass: #Combo1RewardRule 442 | instanceVariableNames: '' 443 | classVariableNames: '' 444 | poolDictionaries: '' 445 | category: 'IngSof1-2019-2C-1Parcial'! 446 | 447 | !Combo1RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 21:41:45'! 448 | createRewardFor: aCustomer 449 | 450 | | price | 451 | 452 | product := self rewardedProduct. 453 | 454 | aCustomer type = #Gold ifTrue: [ price := 75*peso ]. 455 | aCustomer type = #Silver ifTrue: [ price := 83*peso ]. 456 | aCustomer type = #Normal ifTrue: [ price := 97*peso ]. 457 | 458 | ^CoffeeShopReward of: product at: price quantity: self productQuantity! ! 459 | 460 | !Combo1RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 19:54:35'! 461 | productQuantity 462 | 463 | ^2! ! 464 | 465 | !Combo1RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 19:01:41'! 466 | rewardedProduct 467 | 468 | ^#Combo1! ! 469 | 470 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 471 | 472 | !classDefinition: 'Combo1RewardRule class' category: #'IngSof1-2019-2C-1Parcial'! 473 | Combo1RewardRule class 474 | instanceVariableNames: ''! 475 | 476 | !Combo1RewardRule class methodsFor: 'testing' stamp: 'HAW 9/22/2019 19:53:22'! 477 | isFor: volumeSoldToCustomer 478 | 479 | ^volumeSoldToCustomer > (500*milliliter)! ! 480 | 481 | 482 | !classDefinition: #Combo2RewardRule category: #'IngSof1-2019-2C-1Parcial'! 483 | RewardRule subclass: #Combo2RewardRule 484 | instanceVariableNames: '' 485 | classVariableNames: '' 486 | poolDictionaries: '' 487 | category: 'IngSof1-2019-2C-1Parcial'! 488 | 489 | !Combo2RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 21:41:45'! 490 | createRewardFor: aCustomer 491 | 492 | | price | 493 | 494 | product := self rewardedProduct. 495 | 496 | aCustomer type = #Gold ifTrue: [ price := (self priceOf: product)/2 ]. 497 | aCustomer type = #Silver ifTrue: [ price := (self priceOf: product)*3/4 ]. 498 | aCustomer type = #Normal ifTrue: [ price := (self priceOf: product)*9/10 ]. 499 | 500 | ^CoffeeShopReward of: product at: price quantity: self productQuantity! ! 501 | 502 | !Combo2RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 10:23:07'! 503 | productQuantity 504 | 505 | ^1! ! 506 | 507 | !Combo2RewardRule methodsFor: 'reward creation' stamp: 'HAW 9/22/2019 19:00:28'! 508 | rewardedProduct 509 | 510 | ^#Combo2! ! 511 | 512 | "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! 513 | 514 | !classDefinition: 'Combo2RewardRule class' category: #'IngSof1-2019-2C-1Parcial'! 515 | Combo2RewardRule class 516 | instanceVariableNames: ''! 517 | 518 | !Combo2RewardRule class methodsFor: 'testing' stamp: 'HAW 9/22/2019 19:53:22'! 519 | isFor: volumeSoldToCustomer 520 | 521 | ^volumeSoldToCustomer between: 300*milliliter and: 500*milliliter 522 | ! ! 523 | 524 | CoffeeShopSalesSystem initialize! --------------------------------------------------------------------------------