Skip to content

Instantly share code, notes, and snippets.

View chancez's full-sized avatar

Chance Zibolski chancez

View GitHub Profile
int Apothecary::MakePotions()
{
//queue *orders;
//stack *shelf;
Potion currentPotion;
int count = 0;
//orders = new queue(sizeof(orders));
//shelf = new stack(sizeof(shelf));
int Apothecary::MakePotions()
{
int i;
Potion aPotion;
//Begin by checking if the order queue is empty
for (i = 0; !order->isEmpty() ; i++)
{
//If the queue is empty, but the shelf is full,
//than print that its full.
if(shelf->isFull() == true)
ostream& operator<<(ostream& out, const Potion& aPotion)
{
out << "Potion of " << PotionTypeString(aPotion.type) << endl;
return out;
}
const Potion& Potion::operator=(const Potion& aPotion)
{
if (this == &aPotion)
return *this;
else
{
type = aPotion.type;
return *this;
}
int Apothecary::MakePotions()
{
int i;
Potion aPotion;
//Begin by checking if the order queue is empty
for (i = 0; !order->isEmpty() ; i++)
{
//If the queue is empty, but the shelf is full,
//than print that its full.
if(shelf->isFull() == true)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head></head><body>
<h1>CS260 Lab: Player Database</h1>
<h2>Instructions</h2>
<p>
Your RPG game would be incomplete without players so this lab is
going to add a player database. In order to support fast updates to
bool HashTable::retrieve (char const * const name, Player & aPlayer)const
{
//calculate the retrieval position (the index of the array)
int index = calculateIndex(name);
//search for the Player in the chain (linked list)
node * curr = table[index];
char id[100];
char *playerName;
bool HashTable::retrieve (char const * const name, Player & aPlayer)const
{
//calculate the retrieval position (the index of the array)
int index = calculateIndex(name);
//search for the Player in the chain (linked list)
node * curr = table[index];
char *playerName;
while (curr)
int HashTable::calculateIndex(char const * const name) const
{
int length = strlen(name);
int i;
unsigned int sum = int(name[0]);
// Start at 1 because the value for the first character was done above.
for (i = 1; i < length; i++)
{
sum = (sum * 32 + int(name[i]));
#include "Skill.h"
#include "SkillNode.h"
#include <stdlib.h>
SkillNode::SkillNode(): children(NULL)
{
}
SkillNode::SkillNode(Skill& aSkill): skill(aSkill), children(NULL)
{