-
Notifications
You must be signed in to change notification settings - Fork 44
Implementacion clases Queue y Stack #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Se implementaron los metodos faltantes en queue y stack. Se crearon los archivos .cpp de list, queue y stack.
Se implementaron metodos print() en queue y stack, tambien metodos registerDecision y onNewEvent en clase Engine. Se agregaron comandos de consola para CHECK_EVENT, SHO_EVENT y SHOW_HISTORY. Se creo un struct Event para registrar los eventos del jugador.
GabrielEValenzuela
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GJ!
| add_executable(${CMAKE_PROJECT_NAME} ${SRC_FILES} | ||
| src/queue.cpp | ||
| src/stack.cpp | ||
| src/list.cpp | ||
| include/event.h) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esto es redundante, la línea 15 ya lo hace :)
| bool Stack<TData>::isEmpty() const | ||
| { | ||
| return m_top == nullptr; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bool Stack<TData>::isEmpty() const | |
| { | |
| return m_top == nullptr; | |
| } | |
| bool Stack<TData>::isEmpty() const | |
| { | |
| return m_size == 0; | |
| } |
| // Created by nahue on 5/4/2025. | ||
| // | ||
|
|
||
| #include "../include/dataStructures/queue.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #include "../include/dataStructures/queue.hpp" | |
| #include "dataStructures/queue.hpp" |
| current = current->next; | ||
| } | ||
| std::cout << "nullptr" << std::endl; | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Falta un salto de línea aquí
| EXPECT_EQ(s.size(), 3); | ||
| s.pop(); | ||
| EXPECT_EQ(s.size(), 2); | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui
| EXPECT_EQ(q.getSize(), 2); | ||
| q.dequeue(); | ||
| EXPECT_EQ(q.getSize(), 1); | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui
src/stack.cpp
Outdated
| std::cout << temp->data << " "; | ||
| temp = temp->next; | ||
| } | ||
| delete temp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ojo, hacemos un print, por qué añadis un delete? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
estoy creando un nodo temporal para poder iterar y hacer temp->data, pero despues de terminar deberia liberar la memoria o no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya me di cuenta del error!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Genera un cambio mimino y comitealo, veamos que hace el test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Porque me parece que asignas esa dirección de memoria para lectura, entonces el delete no es necesario 🤔
Capaz estoy equivocado
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sisi, estoy creando un puntero pero apunta a direccion de memoria que ya esta creada, con el delete estaria eliminando el ultimo nodo de Stack/Queue. Estaba medio dormido jaja
| // Created by nahue on 5/4/2025. | ||
| // | ||
|
|
||
| #include "../include/dataStructures/stack.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #include "../include/dataStructures/stack.hpp" | |
| #include "dataStructures/stack.hpp" |
src/queue.cpp
Outdated
| std::cout << temp->data << " "; | ||
| temp = temp->next; | ||
| } | ||
| delete temp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Correccion en metodos print de Queue y Stack.
|
@nahuel1114 falla la compilacion 😢 |
Me ayudo chatgpt por que iba mas alla de mis conocimientos pero habian problemas de linkeo cuando se creaba un Queue con Event y un List con Refugiado. Tambien daba problemas al tratarlos de imprimir por pantalla, ya que la funcion print() de Queue realizaba un cout << temp->data pero al estar apuntando a un Event no sabia como resolverlo.
|
Buenas, recien pude hacer que compile, ya realice el commit y el push, mi
duda es si se ve en la PR ya creada o debería crear otra? Gracias.
El lun, 7 abr 2025 a las 21:33, GabrielEValenzuela (<
***@***.***>) escribió:
… @nahuel1114 <https://github.com/nahuel1114> falla la compilacion 😢
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BQWF7PWKD6UDZQ5CY5ROBOD2YMKNHAVCNFSM6AAAAAB2U3D6JCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOBUHEZTENBTGE>
.
You are receiving this because you were mentioned.Message ID:
<GabrielEValenzuela/AlgorithmsAndDataStructures_Course2025/pull/25/c2784932431
@github.com>
[image: GabrielEValenzuela]*GabrielEValenzuela* left a comment
(GabrielEValenzuela/AlgorithmsAndDataStructures_Course2025#25)
<#25 (comment)>
@nahuel1114 <https://github.com/nahuel1114> falla la compilacion 😢
—
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BQWF7PWKD6UDZQ5CY5ROBOD2YMKNHAVCNFSM6AAAAAB2U3D6JCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOBUHEZTENBTGE>
.
You are receiving this because you were mentioned.Message ID:
<GabrielEValenzuela/AlgorithmsAndDataStructures_Course2025/pull/25/c2784932431
@github.com>
|
No description provided.