RSS

Tag Archives: C

Clowns, Psychology and C++

Image

not clowns!

The semester has ended and I’m starting to play with some other projects like C++ coding, working on the next mythology book (this time the educational focus is Latin, rather than science – but I consider it part of the same series) and some other writing projects.  In my most recent C++ coding problems I’ve been trying to get a good handle on how to manipulate objects and create vectors (like arrays) of objects. In order to do this, I’ve made several simple projects to generate a vector of objects (I’ve chosen my vector to be a clown car and my objects to be clowns).

The basic setup was a little tricky (for me), but I managed it with a little help from the good people at dreamincode.org. As the next step in this project, I’m expanding my program to allow for the clowns to interact with one another, eventually kicking one another out of the car. I’ve outlined my basic project on my ayearincoding blog. If you have any interest in coding, take a look there and either learn along with me or help me out.

In looking for some clown art for these posts, I came across an interesting article in smithsonian magazine about the psychology surrounding people’s fear of clowns. The reason I find this particularly interesting right now is two-fold: 1. I’m reading Stephen King’s ‘It’ right now. 2. My wife doesn’t believe me that anyone is afraid of clowns.

 
2 Comments

Posted by on May 13, 2014 in Uncategorized

 

Tags: , , , , , ,

Two Projects

ImageI’ve been playing with a couple computer projects lately. One is trying to pick up some additional HTML / CSS skills so I can have a little better sense of a big picture with my coding club. To this end, I just got a couple of new books, Head First HTML and CSS    and    Head First PHP and MySQL.

So far, I’ve read through a decent amount of the HTML book, which I can skip through pretty easily if I need to as a lot of it is review. However, what I really do find unique about these texts is that they are both comprehensive and interactive. You need to commit to doing the practice exercises as you go along, but seriously, isn’t this what you’re reading this for anyway?

The other project is an infection model. The first iteration of this is similar to the zombie simulations that several people have created online with the exception of having thee classes of people (vaccinated, unvaccinated and infected). As the people wander around in a user-defined room, they may come in contact with one another. In the event that an infected individual comes into contact with an uninfected, unimmunized person, then that person gets infected.

In the currently functional version I can advance one step at a time where all people randomly move on both axes +1, 0 or -1, then are tested for new infections. The next step is to automate the movement and provide reports including how many people are infected each round.

Eventually, I would like to use this to model the spread of infection across the US (using actual state population and size data) and user- supplied info about immunization and infection rates. A similar program exists on the cdc website that simulates the rate of infection spread in a single population. I would like to cross that with a heterogeneous Imagepopulation (different population densities in each state) specific connectivity of states that could mimic regional outbreaks and ultimately a graphical output (this last will likely never happen, but it’s good to have an ideal in mind).

 
Leave a comment

Posted by on September 20, 2013 in Uncategorized

 

Tags: , , , , , , ,

ImageCoding Club today.

There’s a chance I may be getting more takers for my ‘Codecademy’ – based coding club at FSCC soon. Several students have shown interest and I look forward to opening up the class towards becoming a more open space with students (including myself) pursuing a number of projects simultaneously. 

If anyone (local, at least) is interested in joining our group, please feel free. We take all comers and look forward to building our numbers with anyone interested in learning, teaching or challenging themselves.

If you’re not local, I’d still be interested in hearing from you if you’d like to start an online learning community tied to codecademy, code school, or any other online resource.

 
Leave a comment

Posted by on August 30, 2013 in Uncategorized

 

Tags: , , , , , , , , , , , ,

Upcoming Semester

I have about two weeks before the next semester begins. I’m going to be teaching General Biology and MicroBiology in the Fall and the MicroBiology and Ecology in the Spring. During the semester, this blog changes focus to include many more academic topics, but I will still be posting Coding Challenges and other non-biology material. Also, I have moved my comments on film to another page called 100 films in 100 days (a project which I am slightly behind on, but feel like I can still catch up). I have considered splitting my coding posts to another site as well, but I fear that I will fractionate both my audience and my posting frequency in one fell swoop.

As a lead-in to the semester, I thought I would publish the mindmap I constructed for General Biology (I’m hoping to use it as a hyperlinked table of contents in my iBook).

Image

I hope this is readable

 
Leave a comment

Posted by on August 4, 2013 in Uncategorized

 

Tags: , , , , , , ,

Now What?

A number of software development courses, such as Codecademy or even traditional university classes, prepares the student to solve problems using their language of choice, but leaves them unprepared to go to the next step.  This next step is to take what you have created and fold it into something free-standing and usable; Something you can share with friends; Something attractively packaged.

My own dilemma is that I have been taking classes and practicing programming C++ on my mac using XCode as my IDE. Now that I have actually created something (a personal summertime project between classes), I want a good way to present my work. Something more attractive and user friendly than the Terminal environment I currently have.

According to apple, my next step is Cocoa. But, what is Cocoa?

Apple defines Cocoa as “Cocoa is an application environment for both the OS X operating system and iOS, the operating system used on Multi-Touch devices such as iPhone, iPad, and iPod touch.” Which could be meaningful… but not very descriptive to me.

Image

                            Hot Cocoa

For anyone familiar with Apple lore, Cocoa was first introduced as NeXTSTEP in 1989: A product of Steve Jobs’ successor company NexT. “You can use several programming languages when developing Cocoa software, but the essential, required language is Objective-C … You can even mix C++ code with your Cocoa code and link the compiled code into the same executable.”  It is this last phrase that gives me hope that I can figure out how to possibly use the work I have don’t so far and weave it (somehow) together with cocoa to add a friendlier appearance to my work. Furthermore, it looks like I could also use Ruby or Python with Cocoa, two languages that I have been working with and find to be somewhat less awkward at times than C++.

So, how to actually put this together: C++ and Cocoa?

            -I’ve been sifting through resources for a couple days now trying to identify some starting point to this without much luck.

-Perhaps this is the wrong way to go about using my C++ code, but is there another way?

 
Leave a comment

Posted by on August 4, 2013 in Uncategorized

 

Tags: , , , , , , , , , ,

Stack Overflow hates me

ImageI tend to ask a lot of questions that stack overflow considers useless. I understand the format of the site – it’s a place where people can ask questions that can be answered accurately and with references. An easy way to get your question flagged is to ask for a recommendation for something – a question that can only be answered by opinion and therefore does not have a discrete, ‘provable’ answer.

However, I still want my questions answered. I really do need help and I’m not sure where else to turn to get it (to reach such a well experienced audience).

What I am dealing with is:

ImageI have a small C++ program that I have developed in Xcode. Things are pretty close to working, but I would like to take my program and wrap it in a more attractive user  interface. Somehow, I thought I was just needing to learn some more C++. I thought that was all in ‘book 2’ or something. But I am getting the impression that I need another program and I have no idea where to start.

(The layers of programming are amazingly deep)

So, please write if anyone out there knows of

#1 a good program to do this with -or- a way to approach it by linking my C++ programs in XCode to an objective-C interface (blahblah, these are words I can repeat, but I don’t understand how to do it)  

#2 know a website / book / youtube channel that embodies a walkthrough approach to doing this

 
Leave a comment

Posted by on August 2, 2013 in Uncategorized

 

Tags: , , , , , , , , ,

RubyMonk

ImageI mention codecademy all the time here and rant about how great a way it is to learn a variety of languages and markups online, on your own time and free. I’ve been following both the web programming track and the Ruby tracks aggressively lately (I’m on a 20 day streak presently). However, I have to also mention another free site that does much the same thing. RubyMonk offers free online courses in Ruby (and Python, under PythonMonk). The Monk websites are clean, well structured and provide an element of atmosphere as well.

Unfortunately, RubyMonk does not provide a forum where I can pitch my project challenges – er, I mean Koans. But if you are learning Ruby or Python with the Monk, please feel free to come here from time to time to see if there are any simple programming challenges open.

 
Leave a comment

Posted by on June 28, 2013 in Uncategorized

 

Tags: , , , , , , , , ,

Winding down Coding Challenge I

ImageI’ve received several entries answering my coding challenge to demonstrate / test Goldbach’s Conjecture that all even numbers > 4 are the sum of two primes. So far python has been the language of choice for entries.

 

I will be closing down this challenge as of June 30 at 11:59pm.

Once I take a look at the entries, I’ll award the prize, a copy of my iBook, In Parts to the winner and post the code here with a walkthrough to show how the problem was tackled as well as any interesting comparisons between entrants.

 
Leave a comment

Posted by on June 26, 2013 in Uncategorized

 

Tags: , , , , , , , , , , , , ,

Coding Challenge II: Make Mine a MASTERmind

ImageDon’t worry, Coding Challenge I is still open, but someone was writing about games to develop in the codecademy discussion groups. 

A while ago, when I was first following the JavaScript pathway, there, I decided to write a MasterMind program. Many of the versions I saw prohibited players from using the same number/color more than once, but I felt that was a cop-out. My solution works, but as usual for me, had some tortuous logic.

So, here’s the challenge:

In any language, write a MasterMind game where the computer chooses the numbers and the user deduces them.

1. use numbers (four of them,#s1-4, randomly chosen by the computer), rather than colors

2.  that allows multiple uses of the same numbers, i.e. ‘1122’

3. provides appropriate feedback to the user to help them close in on the correct sequence.

4. keeps track of the number of turns taken

5. (optional) can also be played with 2 users -or- user sets the code and computer guesses

6. (optional) allow user to select # of positions and range of numbers used.

 

simple code trumps tangly code. I prefer languages I can read (C++, javascript, python) but all are welcome.

 
Leave a comment

Posted by on June 22, 2013 in Uncategorized

 

Tags: , , , , , , , ,

Project One of my Game Development Class made my head explode

I’m taking an intro Game Development course online (it’s well known that I hate online courses in general) and here I am on what amounts to day three and I’m struggling.

Image

Do this Stuff. Don’t worry, it’s easy.

Instructor:”So, you just need to make up this data tree thing with nodes and identifiers and stuff… look, just do it and get back to me. Here’s an outline:

  1. Each node has an ID property which is unique number identifying the node
  2. Each node as a Report() method that will print to the console it’s ID and if its a leaf or not
  3. When created, the tree has a single node, the root
  4. The tree has a SplitLeafs() method which will cause all leafs to create two children
  5. The tree has a VisitAll() method which will visit every node and call the node’s Report() method
  6. The tree has a LeafReport() method which call Report() on just the leaf nodes
  7. In your main() method in Program.cs/Main.cs, you have the following:
    1. Create a tree
    2. Call VisitAll() on the tree
    3. Call SplitLeafs() on the tree
    4. Call LeafReport() on the tree
    5. Call SplitLeafs() on the tree
    6. Call VisitAll() on the tree”
Image

OK…

Me: “Um, OK. I don’t really know what this is, but if you say it’s easy, I’m sure that I can figure it out.”

 

Instructor:”Got it yet?”

Image

Arghh!!!

Me: “Arghh… Let’s see: Tree class and Node class… How do I instantiate these things?

The root has no parent, but has children…”

Instructor:”Yeah. You totally have it. Let’s talk about the completed project tomorrow.”

Me:”Oh crap. So, the tree just gets made once, but then it makes the nodes…? Each node will hold some data: let’s keep that simple. Make it an integer.

Image

What the hell’s a leaf?

Ughh. Simple isn’t simple enough.” 

Image

Feeling the heat now?

Instructor:” A leaf if just a node. It has a parent, but no children.”

 

Me:  “And, how to we do this splitLeaf thing?”

Image

Cripes! instantiate two children from each leaf….how… to…?The pain!

 

Instructor:” Look, it’s just a couple methods within the class. write up a couple setters and a couple getters and then one or two other methods to do the work.”

Image

Look, I don’t mean to tighten the screws or anything, but this needs to be done and uploaded onto the Google+ document space…

 

 

I’m not kidding. I went from dominating my into C++ class to being a joke in this next class. I’ll try to  deconstruct the problem and post a walkthrough of the general idea if anyone’s interested.

Image

Google+? Wha…..

 
Leave a comment

Posted by on June 20, 2013 in Uncategorized

 

Tags: , , , ,