Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
c_pokedex_assignment
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
elijah vasquez
c_pokedex_assignment
Commits
e4ce6059
Commit
e4ce6059
authored
Jan 17, 2023
by
elijah vasquez
🦍
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hellyeah
parent
8e533737
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
15 deletions
+19
-15
functions.h
functions.h
+11
-11
liststructure.c
liststructure.c
+8
-4
main.exe
main.exe
+0
-0
No files found.
functions.h
View file @
e4ce6059
...
@@ -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
...
...
liststructure.c
View file @
e4ce6059
// 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"
);
...
...
main.exe
View file @
e4ce6059
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment