Commit e4ce6059 authored by elijah vasquez's avatar elijah vasquez 🦍

hellyeah

parent 8e533737
...@@ -27,9 +27,9 @@ typedef struct Pokedex // To house the header nodes to start single ...@@ -27,9 +27,9 @@ typedef struct Pokedex // To house the header nodes to start single
// Pokemon List // Pokemon List
PokemonNode* NewPokemonNode(char name[20], char type[20], char ability[30]); PokemonNode* NewPokemonNode(char name[20], char type[20], char ability[30]); // Create new pokemon
void AddPokemonToList(Pokedex* pokedex, char name[20], char type[20], char ability[30]); void AddPokemonToList(Pokedex* pokedex, char name[20], char type[20], char ability[30]); //Add pokemon to list
PokemonNode* FindPokemon(Pokedex* pokedex, char name[20]); PokemonNode* FindPokemon(Pokedex* pokedex, char name[20]); //Find pokemon within list
// Player List // Player List
PlayerNode* NewPlayerNode(char name[50]); // Create new node, return pointer to node PlayerNode* NewPlayerNode(char name[50]); // Create new node, return pointer to node
......
// Calling of functions and setting up nodes // Calling of functions
#include "functions.h" #include "functions.h"
int main(void) int main(void)
{ // Adding Pokemon nodes to list { // Adding Pokemon nodes to list
Pokedex* pokeHead = NewPokemonNode("blastoise", "water", "torrent"); //Creation of node to introduce head of single linked list Pokedex* pokeHead = NewPokemonNode("blastoise", "water", "torrent"); // Creation of new pokemon as node to introduce head of single linked list
AddPokemonToList(pokeHead, "dragapult", "dragon", "infiltrator"); AddPokemonToList(pokeHead, "dragapult", "dragon", "infiltrator");
AddPokemonToList(pokeHead, "volcarona", "fire", "flame body"); AddPokemonToList(pokeHead, "volcarona", "fire", "flame body");
AddPokemonToList(pokeHead, "regieleki", "electric", "transistor"); AddPokemonToList(pokeHead, "regieleki", "electric", "transistor");
// Adding player nodes to player list // Adding player nodes to player list
Pokedex* playerHead = NewPlayerNode("armin"); Pokedex* playerHead = NewPlayerNode("armin"); // Creation of new player as node to introduce head of player list
AddPlayerToList(playerHead, "chase"); AddPlayerToList(playerHead, "chase");
AddPlayerToList(playerHead, "ziggy"); AddPlayerToList(playerHead, "ziggy");
// Linking pokemon with players // Linking pokemon with players
AddPokemonToPlayer(pokeHead, playerHead, "armin", "blastoise"); AddPokemonToPlayer(pokeHead, playerHead, "armin", "blastoise"); // pointer variables from above used within parameter to assign pokemon to players
AddPokemonToPlayer(pokeHead, playerHead, "armin", "dragapult"); AddPokemonToPlayer(pokeHead, playerHead, "armin", "dragapult");
AddPokemonToPlayer(pokeHead, playerHead, "chase", "volcarona"); AddPokemonToPlayer(pokeHead, playerHead, "chase", "volcarona");
AddPokemonToPlayer(pokeHead, playerHead, "ziggy", "regieleki"); AddPokemonToPlayer(pokeHead, playerHead, "ziggy", "regieleki");
...@@ -25,6 +25,10 @@ int main(void) ...@@ -25,6 +25,10 @@ int main(void)
ListPlayers(playerHead); ListPlayers(playerHead);
// Display details of each player // Display details of each player
/*
This section can be regarded as a dissection of ListPokemon
and ListPlayers.
*/
DisplayPlayerDetails(playerHead, "armin"); DisplayPlayerDetails(playerHead, "armin");
DisplayPlayerDetails(playerHead, "chase"); DisplayPlayerDetails(playerHead, "chase");
DisplayPlayerDetails(playerHead, "ziggy"); DisplayPlayerDetails(playerHead, "ziggy");
......
No preview for this file type
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