PHAEGRAM

A journal about creating computer games, 3d graphics, iPhone development, etc...

SKILLS/AREAS OF INTEREST: Maya, Zbrush, OpenGLES, design, cognition, optical illusions, strategic/open ended puzzles.

Contact: rdwirtz@gmail.com

coin counting program

where have i been? nearly losing my mind writing my first algorithm.

after about a week of tortured evenings, i solved it thanks to a clear process i now have.

=^_^=

/***********************************************************

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

 CHANGE COUNTER

 Displays how many quarters, dimes, nickels, and pennies are

 needed for a money amount less than $1.00.

 Bob Wirtz

 Programming exercise. Displays how many quarters, dimes, 

 nickels, and pennies are needed for a money amount less 

 than $1.00. the program counts the number of coins needed 

 to equal the inputted amount from the largest denomination 

 to smallest (quarters, dimes, nickels, pennies)

 Simple usage. Just run the program…

 Version 1.0

 Copyright 2012 Synkrex

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

 ***********************************************************/

#include <iostream>

// coins

float quarter;

float dime;

float nickel;

float penny;

// coin count

int quarter_count;

int dime_count;

int nickel_count;

int penny_count;

float money_amount; // amount of money to be counted

int main (int argc, const char * argv[])

{

    // 01 how much money is there to be counted?

    std::cout « “Enter an amount of money less than $1.00: “ « “\n”;

    std::cin » money_amount;   // input money amount less than $1.00

    // 02 what are the different values of the coins?

    quarter = 0.25;

    dime = 0.10;

    nickel = 0.05;

    penny = 0.01;

    // 03 Q: which of the coins do i start counting first? 

    //    A: count in descending order from the largest to the smallest compared

    //    to the value to be counted. 

    // 04 while the amount of money is greater than or equal to 0.25, then count quarters

    while (money_amount >= 0.25) {

        quarter_count++;

    // 05 subtract the combined value of the counted quarters from the amount to 

    //    be counted. the amount counted is now less.

        money_amount = money_amount-quarter;        

    }

    // 06 while the amount of money is greater than or equal to 0.09, then count dimes

    while (money_amount >= 0.09) {

        dime_count++;

        // 07 subtract the combined value of the counted dimes from the amount to 

        //    be counted. the amount counted is now less.

        money_amount = money_amount-dime;        

    }

    // 08 while the amount of money is greater than or equal to 0.04, then count nickels

    while (money_amount >= 0.04) {

        nickel_count++;

        // 09 subtract the combined value of the counted dimes from the amount to 

        //    be counted. the amount counted is now less.

        money_amount = money_amount-nickel;        

    }

    // 10 while the amount of money is greater than 0 and equal to or less than

    //    four, then count pennies

    while (money_amount > 0 && money_amount <=0.04) {

        penny_count++;

        // 11 subtract the combined value of the counted pennies from the amount to 

        //    be counted. the amount counted is now less.

        money_amount = money_amount-penny;        

    }

    // 12 show the amount of coins counted

    std::cout « “quarters: “ « quarter_count « “\n”;

    std::cout « “dimes: “ « dime_count « “\n”;

    std::cout « “nickels: “ « nickel_count « “\n”;

    std::cout « “pennies: “ « penny_count « “\n”;

    return 0;

}

simple rectangle perimeter calculator (exercise 5-3)

/***********************************************************

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

 RECTANGULAR PERIMETER CALCULATOR

 Calculates the perimeter of a rectangle based on the 

 length and width inputted.

 Bob Wirtz

 Programming exercise. Calculates rectangle perimeter

 based on length and width input.

 Simple usage. Just run the program…

 Version 1.0

 Copyright 2012 Synkrex

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

 ***********************************************************/

#include <iostream>

// rectangle dimensions

float rectangle_width;

float rectangle_length;

int main (int argc, const char * argv[])

{

    // input rectangle width 

    std::cout « “Enter rectangle width: “ « “\n”;

    std::cin » rectangle_width;

    // input rectangle length 

    std::cout « “Enter rectangle length: “ « “\n”;

    std::cin » rectangle_length;

    // calculate perimeter based on length and width input

    std::cout « “perimeter is: “ « (rectangle_width+rectangle_length)*2 « “\n”;

    return 0;

}

square one

i’ve realized over  the past few days that i’ve kinda bitten off more than i can chew… game modding (at least to me it seems) requires that you have some familiarity with programming and file structures etc. which i currently have essentially have very little. as ridiculous as it sounds, iPhone development is equally overwhelming.

so…

i’m literally working my way through o’reilly’s “practical c++ programming” while also reading “real-time rendering.” the latter i only somewhat understand, but it is shedding light on a lot of terms and concepts that i’ve only heard of in passing. i’m also looking forward to checking out “mathematics for computer graphics” which should be arriving in a few days.

i want to complete the exercises in the c++ book within this month (i’m currently on chapter 5 out of i think 27). as a reward, i want to look further into another o’reilly book “AI for game developers.” chapters on neural networks and genetic algorithms caught my eye….

test rooms

from now on i’m just going to experiment with these test rooms. i was starting to gradually play the game. not for me…

tried loading the maze as a map, but it didn’t work. thinking that i needed all files (.map, .cm, .proc files at least) i copied the test_box map. also didn’t work.

i can now see why this kind of thing is called “hacking.” a gradual process of trying a bunch of things and having it not work, but interesting things are uncovered…..

lotsaimps on Flickr.

lotsaimps on Flickr.

boxroom on Flickr.

boxroom on Flickr.

maze level on Flickr.attempted level map. originally a model for a unity game.

maze level on Flickr.

attempted level map. originally a model for a unity game.

circular maze on Flickr.attempted level map. originally a model for a unity game.

circular maze on Flickr.

attempted level map. originally a model for a unity game.

skull hi res on Flickr.original high poly model (524288 polys) &#8230; made in zbrush

skull hi res on Flickr.

original high poly model (524288 polys) … made in zbrush

low res skull fragment wire on Flickr. ow poly model experiment - 2116 polys

low res skull fragment wire on Flickr. ow poly model experiment - 2116 polys