I’ve decided on a change of pace, for the site, and for the use of my spare time.
My dad often used to remark about how he’d buy me a new game, only to be dismayed that I never played them; I’d just boot straight into the level editor and begin making whatever I had wanted to see or play. I think during my formative years I had often dreamed of becoming a level or environment designer for studios like the now defunct Lionhead (Big Blue Box Studios), Sega, Lucas Arts, Rockstar Games, or any of the other studios that often consumed vast portions of my adolescent life.
I think this was my major motivator to get a bachelors in computer science, though I wasn’t brave enough to dive directly into the games course itself. I graduated and earned a 2.1, dragged down by some of the less interesting modules (SQL, I hardly knew ye). Since then though, I’ve never used any of the skillset outside of sporadic PowerShell scripts for my day-to-day job.
Hello, world.
I’ve decided that I want to get my training wheels back on, and I’m picking up programming again.

I’ve started in earnest, and begun to follow the Harvard CS50 course; after all it’s free, and brilliant. The production quality alone is astounding for an educational product.
Since starting the CS50 course, I created a fully functioning game in the first day (Using scratch, which is significantly less impressive, but it’s progress nonetheless), and I’ve then been able to shake some of the rust off and make some progress (admittedly, with some interesting results; my maths and logic are still a little out, see the pyramid example below).


All of this surmounts to my goal for “30” (I’m 30 in a few months, this is a project for the duration of “30”), which is to have made several smaller prototypes of “Functional” game elements. I’ve got some pencilled out in my mind, and I’ll post updates here as I go.


The above error was caused by a nested loop in my pyramid writing function, removing it stopped the Sydney Opera House making it’s cameo. Instead I opted for the second variable being for a gap between mirrored pyramids (per the project brief).

I’ve included my code for this small project below.
If you have questions, comments, feedback, or advice, feel free to comment.
#include <cs50.h>
#include <stdio.h>
/*
Pseudocode:
i = 0;
For each row (pyramid.height)
i++
Print whitespace (Pyramid height - i)
Print hashes (i)
Print whitespace (Pyramid height - i)
*/
/* Structures */
typedef struct
{
int height; // Store height
int gap; // Store gap
} dimensions; // create structure "dimensions"
/* Prototype Functions */
dimensions get_input(); // new function that processes dimensions structures
void print_whitespace(int n);
void print_block(int n);
void print_pyramid(int row, int gap);
/* Main */
int main(void)
{
dimensions pyramid =
get_input(); // Returns "pyramid" structure with user defined "height" and "width" variables
printf("Height: %i\n", pyramid.height); // Write the dimensions to screen
print_pyramid(pyramid.height, pyramid.gap); // Print pyramid based on given dimensions
}
/* Functions */
dimensions get_input()
{
int i = 0;
int j = 0;
dimensions p; // temporary struct
do // While varaiables entered are less than 1, keep asking
{
i = get_int("Enter your pyramid height: ");
j = get_int("Enter your pyramid gap: ");
}
while ((i < 1 || i > 8) && (j < 1 || j > 8));
p.height = i; // write to temp struct
p.gap = j;
return p; // return temp to main "Pyramid" struct
}
void print_whitespace(int n)
{
for (int i = 0; i < n; i++)
{
printf(" ");
}
}
void print_block(int n)
{
for (int i = 0; i < n; i++)
{
printf("#");
}
}
void print_pyramid(int row, int gap)
{
int increment = 0;
for (int i = 0; i < row; i++)
{
increment++;
print_whitespace(row - increment); // Print left to right ascending pyramid
print_block(increment);
print_whitespace(gap); // Print the gap
print_block(increment); // Print right to left ascending pyramid
print_whitespace(row - increment);
printf("\n");
}
}
Leave a comment