Baby steps- catching dreams

Image

We should be working

I’ve been trying to get more sleep lately. This means that a significant portion of my ‘coding time’ has now been exchanged for ‘sleeping time.’ That, in turn, means much less progress with my latest coding project, the Pokemon Card Game.

The major goal of this project is to familiarize myself with vectors and how to manipulate them easily, moving items from one vector to another, deleting them, changing aspects of single vector objects, etc. So fa, this has been somewhat achieved. I have definitely become more familiar with the idea of the vector (it’s an array with more reasonable manipulations). The problem is, I still run into problems with these manipulations (unable to delete items from a vector, etc).

Image

I’m not sure this thing will work

Secondary goals involve:

1. Presenting a more civilized (although still ASCII) interface. I would love to leave ASCII and the terminal behind, but that has been a very elusive goal that I have no idea how to tackle.

2. Building in more realistic randomness into the play while also shepherding this randomness into better gameplay (attacks are randomized, but contain modifiers to make them more challenging)

3. Trying to keep my code simple and organized

 

Let’s be honest, #3 has been right out the window.

#2 is coming, and I think it should be more straight-forward than my other issues, but it’s still not implemented.

#1 is the only thing I worked on at all last night. Although I have good ideas about how I could make this much better, I’m not letting ‘the perfect’ get in the way of ‘the good’ just yet. Right now, this is about what the interface looks like:

 

Screen Shot 2014-06-24 at 8.31.49 AM 

Advertisements

Advancing the Pokemon

I’m not unstuck yet, but I am advancing a bit.

I just finished playing with the code a bit trying to tackle one small problem at a time rather than trying to solve the whole thing all at once. This strategy has proven more and more successful as the program has grown.

Please note that there are several superfluous statements here in order to follow the process more closely. At this point I have been trying to get the points taken care of properly and recognize when someone has less that 1 pt left (making them dead). 

The next steps are to pop dead pokemon out of the player / computer’s hand and then advance the remaining pokemon to the fore.

Here’s a copy of the text from the latest run:

**************

**********

Player’s hand is empty.

**********

Computer’s hand is empty.

**********

**********

IDNumber = 1, name = Pikachu

IDNumber = 2, name = Froky

IDNumber = 3, name = FurFrou

IDNumber = 4, name = Meowth

IDNumber = 5, name = BunnleBy

IDNumber = 6, name = BeeDrill

IDNumber = 7, name = Gloom

IDNumber = 8, name = Diglett

**********

Player, please choose a Pokemon from the draw pile (enter ID number)

4

You chose number 4, Meowth

player’s hand:

IDNumber = 4, name = Meowth

IDNumber = 0, name = 

**********

IDNumber = 1, name = Pikachu

IDNumber = 2, name = Froky

IDNumber = 3, name = FurFrou

IDNumber = 5, name = BunnleBy

IDNumber = 6, name = BeeDrill

IDNumber = 7, name = Gloom

IDNumber = 8, name = Diglett

**********

**********

computer’s hand:

IDNumber = 5, name = BunnleBy

IDNumber = 0, name = 

**********

IDNumber = 1, name = Pikachu

IDNumber = 2, name = Froky

IDNumber = 3, name = FurFrou

IDNumber = 6, name = BeeDrill

IDNumber = 7, name = Gloom

IDNumber = 8, name = Diglett

**********

Player, please choose a Pokemon from the draw pile (enter ID number)

7

You chose number 7, Gloom

player’s hand:

IDNumber = 4, name = Meowth

IDNumber = 7, name = Gloom

**********

IDNumber = 1, name = Pikachu

IDNumber = 2, name = Froky

IDNumber = 3, name = FurFrou

IDNumber = 6, name = BeeDrill

IDNumber = 8, name = Diglett

**********

**********

computer’s hand:

IDNumber = 5, name = BunnleBy

IDNumber = 2, name = Froky

**********

Finished drawing cards.

 

 

 

 

 

 

**********

IDNumber = 4, name = Meowth

IDNumber = 7, name = Gloom

**********

IDNumber = 5, name = BunnleBy

IDNumber = 2, name = Froky

**********

**********

Which Pokemon will you send into battle? (select ID number)

IDNumber = 4, name = Meowth

IDNumber = 7, name = Gloom

7

Gloom is the player’s current Pokemon.

Froky is the computer’s current Pokemon.

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 100 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 100 Status: alive

Select an attack (by number):

Attack 1 = Acid

Attack 2 = Swwet Scent

Attack 3 = Poison Powder

3

Gloom attacks Froky using Poison Powder

Begin Battle

Yes! Hit.

Gloom scores 45 using Poison Powder.

End Battle

player turn = false

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 100 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 55 Status: alive

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 100 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 55 Status: alive

Select an attack (by number):

Attack 1 = Acid

Attack 2 = Swwet Scent

Attack 3 = Poison Powder

3

Gloom attacks Froky using Poison Powder

Begin Battle

missed – Drat!!

End Battle

player turn = false

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 100 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 55 Status: alive

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 100 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 55 Status: alive

Select an attack (by number):

Attack 1 = Acid

Attack 2 = Swwet Scent

Attack 3 = Poison Powder

3

Gloom attacks Froky using Poison Powder

Begin Battle

Yes! Hit.

Gloom scores 45 using Poison Powder.

End Battle

player turn = false

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 100 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 10 Status: alive

Froky attacks Gloom using water drip

Begin Battle

Yes! Hit.

Froky scores 20 using water drip.

End Battle

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 80 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 10 Status: alive

Select an attack (by number):

Attack 1 = Acid

Attack 2 = Swwet Scent

Attack 3 = Poison Powder

3

Gloom attacks Froky using Poison Powder

Begin Battle

missed – Drat!!

End Battle

player turn = false

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 80 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 10 Status: alive

Froky attacks Gloom using quick attack

Begin Battle

missed – Drat!!

End Battle

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 80 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = 10 Status: alive

Select an attack (by number):

Attack 1 = Acid

Attack 2 = Swwet Scent

Attack 3 = Poison Powder

2

Gloom attacks Froky using Swwet Scent

Begin Battle

Yes! Hit.

Gloom scores 15 using Swwet Scent.

Froky is dead.

<<<<<<<<<<<<<+++++++++>>>>>>>>>>>>>>>>>>>

End Battle

player turn = false

 

 

 

 

 

 

 

 

 

 

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 80 Status: alive

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = -5 Status: dead

Froky attacks Gloom using water drip

Begin Battle

missed – Drat!!

End Battle

Popping 1 Pokemon, named Froky

Computer has advanced BunnleBy into attack position.

Player’s Deck

—————

IDNumber = 4 Name = Meowth, hp = 100 Status: alive

IDNumber = 7 Name = Gloom, hp = 80 Status: alive

 

 

 

 

Computer’s Deck

—————

IDNumber = 5 Name = BunnleBy, hp = 100 Status: alive

IDNumber = 2 Name = Froky, hp = -5 Status: dead

Select an attack (by number):

Attack 1 = Acid

Attack 2 = Swwet Scent

Attack 3 = Poison Powder

(I quit the program here)

Transformation – a plan of attack

Image

Click this image to try to catch up with Jason Wellborn – The image was easier to find than the attribution

I have to admit, with yesterday’s release of Apple’s new Swift programming language, it is tempting to try to remake this whole thing as a swift program in XCode. I think for now I’ll stick with C++, but I just downloaded the Swift programming guide from the iBook store…

 

Project: Transform the clown car simulation into a game of Pokemon.

Requirements:

  1. Make a Draw pile (deck) with all the Pokemon that will be included in the game
  • Use vectors for decks
  • Pokemon each have a name, an ID number, hit points, and three attacks
  1. Make two separate piles (decks) for the player and the computer (opponent)
  2. allow player to select Pokemon from the Draw Pile (select Pokemon by ID number) – select 2
  3. computer selects Pokemon from Draw Pile (randomized, by position in vector) – select 2
  4. Import the player’s and computer’s decks to a battle function
  5. Battle Function
  • Player and Computer select first Pokemon to fight
  • battle function or some other subset function will need to distinguish the two decks as attacker and defender
  • take turns selecting attacks (attack success should have inverse probability  of hit chance and damage done – set base to 50%, then use modifiers to adjust for each attack)
  • be sure to manage hp properly – use clown car model
  • if a Pokemon is reduced to <= 0 hp, it is defeated and that player’s other Pokemon is advanced to fighting position.
  • If second Pokemon is defeated, declare other team winner