Commit 45c7e79f authored by jithushan.umaipalan's avatar jithushan.umaipalan

Initial commit/remote repo

parents
**/__pycache__
.env
*.tmp
.vscode/*
\ No newline at end of file
This diff is collapsed.
# Code
Use Linked List to store the pokedex
Feature Requirements
1. A `Pokedex` struct holding the `ptr` for the `Pokemon Node` and the `Player Node`
2. Pokedex struct should be created and passed onto function to make operations.
3. Pokemons and Players should be a LinkedList.
4. Pokemon Node should store a pokemons' (name, type, primary abilities)
5. Create functions to add, create, find nodes (by pokemon name).
6. Pokemon Functions:
- [x] newPokemonNode(name, type, ability) -> ptr*Pokemon Node
- [x] addPokemonToList(*pokedex, name, type, ability) -> void
- [x] findPokemon(pokedex, name) -> ptr*Pokemon Node
7. Player Functions:
- [x] newPlayerNode(name) -> ptr*Player Node
- [x] addPlayerToList(*pokedex, name) -> void
- [x] findPlayer(pokedex, name) -> ptr*Player Node
- [x] addPokemonToPlayer(pokedex, playerName, pokemonName) -> void (adds pokemon if not found else increment it count)
8. Pokedex Functions:
- [x] displayPokemonDetails(pokedex, name) -> void (displays all details )
- [x] displayPlayerDetails(pokedex, name) -> void (displays all details along the details of the pokemons owned)
- [x] listPokemons(pokedex) -> void (displays list of names)
- [x] listPlayers(pokedex) -> void (displays list of names)
# Report
1. Created structs/classes.
2. Types of lists chosen (array, list, etc).
3. Memory location and pointers
4. Explain the `DisplayPlayerDetails()` function.
#include <iostream>
#include <string>
// import linked list file
#include "LinkedLists.h"
int main()
{
// create pokedex
PokeDex *pokedex = new PokeDex;
// list of list of pokemons
vector<vector<string>> pokemonsArr = {
{"Bulbasaur", "Grass", "Overgrow"},
{"Charmander", "Fire", "Blaze"},
{"Squirtle", "Water", "Torrent"},
{"Caterpie", "Bug", "Shield Dust"},
{"Metapod", "Bug", "Shed Skin"},
{"Butterfree", "Bug", "Compound Eyes"},
{"Beedrill", "Bug", "Swarm"},
{"Pidgey", "Normal", "Keen Eye"},
{"Rattata", "Normal", "Run Away"},
{"Ekans", "Poison", "Intimidate"},
{"Pikachu", "Electric", "Static"},
{"Sandslash", "Ground", "Sand Veil"},
{"Nidoran", "Poison", "Poison Point"},
{"Clefairy", "Fairy", "Cute Charm"}};
// create pokemon nodes
for (int i = 0; i < pokemonsArr.size(); i++)
{
addPokemonToList(pokedex, pokemonsArr[i][0], pokemonsArr[i][1], pokemonsArr[i][2]);
}
// add player to pokedex
addPlayerToList(pokedex, "Ash");
addPlayerToList(pokedex, "Misty");
listPlayers(pokedex);
listPokemons(pokedex);
// // add pokemons to player
addPokemonToPlayer(pokedex, "Ash", "Bulbasaur");
addPokemonToPlayer(pokedex, "Ash", "Charmander");
addPokemonToPlayer(pokedex, "Ash", "Squirtle");
addPokemonToPlayer(pokedex, "Ash", "Squirtle");
addPokemonToPlayer(pokedex, "Misty", "Caterpie");
addPokemonToPlayer(pokedex, "Misty", "Metapod");
addPokemonToPlayer(pokedex, "Misty", "Butterfree");
displayPlayerDetails(pokedex, "Ash");
displayPlayerDetails(pokedex, "Misty");
displayPokemonDetails(pokedex, "Bulbasaur");
}
\ No newline at end of file
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment