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 

Halt and Catch Fire

Undocumented Code: HCF

100 Films in 100 Days

Image Boy, I really do look like Mary Stuart Masterson

Is this show something more than a tense relationship between a meterosexual narcissist with vision, a brooding middle aged hardware designer with struggling between his need for self-fulfillment and familial responsibilities, and a young genius who is obviously the love child of Meg Ryan and Mary Stuart Masterson?

I couldn’t help but be drawn in right away by Joe’s Porsche 944. My wife says that any Porsche is an indication that a guy is a real ass, but I’ve always dreamed of owning a 944 someday anyway. Maybe I’m just an ass.

So, what’s good about Halt and Catch Fire?

1. Gordon Clark – his character is awesome. He’s talented but scarred. There’s a history of a previous computer project that had serious consequences for him and his family. He’s dying to break out and create something, but he…

View original post 1,124 more words

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)

The Turing test doesn’t matter

An excellent exploration of the Turing test, AI, and the ability of the former to assess the later. I especially agree with Mr. Pigliucci’s argument that we really don’t even know what we are looking for with this test. We’re apparently asking whether some ‘being’ is close enough to us in its way of thinking and expressing itself that we are fooled into assuming that it is human.
The question is pushed into one of ‘what is it to be human?’ or ‘can we even believe that other humans are human?’
Does cloning / synthesizing the attributes of a human make a human? This might be a problem of too much ‘teaching to the test.’
And, again, the author reminds us that we actually want to believe in agency. It works with the way we think…
He continues,”I’d wager that ants, for instance, have no self-awareness,” yet we want to see intelligence in what they do.

A great question and a great article.

Scientia Salon

turing testby Massimo Pigliucci

You probably heard the news: a supercomputer has become sentient and has passed the Turing test (i.e., has managed to fool a human being into thinking he was talking to another human being [1,2])! Surely the Singularity is around the corner and humanity is either doomed or will soon become god-like.

Except, of course, that little of the above is true, and it matters even less. First, let’s get the facts straight: what actually happened [3] was that a chatterbot (i.e., a computer script), not a computer, has passed the Turing test at a competition organized at the Royal Society in London. Second, there is no reason whatsoever to think that the chatterbot in question, named “Eugene Goostman” and designed by Vladimir Veselov, is sentient, or even particularly intelligent. It’s little more than a (clever) parlor trick. Third, this was actually the second time that a chatterbot passed…

View original post 2,075 more words

Stuck in the mud

ImageIt’s not that I haven’t been trying to move forward with this program (the Pokemon thing), the problem is that I’ve gotten stuck in the mud. I don’t think the problem is really so huge, but that I’m having trouble figuring out what the problem actually is. There’s just not sufficient direction in my debugger to point me to the problem.

Xcode 6 and SWIFT

dasdas-copy2

From the 2014 WWDC

Apple unveiled the new programming language that it wants developers to use in making iOS and OSX apps this week. This sent me scrambling to a place where I could download large files for free (not my house) to get the new version of XCode so I could try it out. I also liked the idea of starting on the ground floor with every other developer on the day it was released.

About 24 hours later, I finally have the new XCode beta downloaded and installed on my computer (storage space on my MacBook Air is always at a premium). I have not yet been able to install the new iOS on my phone because I simply have too many pictures cluttering up the storage space there too – I’ll deal with that later, when I can hook up to my external drive – and I have not been able to download Yosemite yet for some other reason. I know this isn’t the storage problem – at least not yet. But I still haven’t worked out the kinks on that one.

So… what can we expect from this new SWIFT / XCode combination? One thing that I’m certain a lot of people have been looking forward to, is a more integrated coding space. Bret Victor gave a talk at the 2012 CUSEC (Canadian University Software Engineering Conference) presenting this idea in a pretty solid demo that illustrated everything from side-by-side coding and output for graphics and even a simple sorting loop. In both examples, we see how easily this kind of work environment leads to debugging before you are even finished typing in the buggy line of code.

I was going to clip a section of the talk to show the moments where Bret really nailed his idea, but the whole talk is just so remarkable, I suggest you watch it all – if you haven’t already. And if you have, watch it again. It’s that good.

Back to today…

Does this mean that I’ve been cranking out new Swift code all day? No. Sadly.

There’s a couple (maybe three) roadblocks in place for me before I can do that.

  1. Even though I have XCode up and running, I can’t figure out how to start playing with Swift in the playground.
  2. I have studying for that Chemistry content exam I need to take.
  3. I keep getting distracted by writing posts for my blogs.

That said. I’m back to it. By the way, I really have to hand it to KhanAcademy. It’s made studying a much more engaging pursuit. I highly recommend this site for any student in a class covered by his material.

Here’s a clip of video from the Swift announcement at WWDC. Compare it to what you just saw from Ken Victor.

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

Previous Older Entries