My First Original Program

I’m doing something called the Landmark Forum, which is like a group event that helps you gain the possibility to have anything you truly want.

During the forum, we chose problems worthy of our lives.

I turned to my friend Amanda, and in that instant decided I didn’t want to tell her a small, reasonable problem. Her gaze challenged me- it made me want to be great.

I confided in Amanda that I want to create the possibility in the minds of Humankind that Humankind becomes relevant on the universal level.

I thought, while this problem is real to me, it’s ridiculous and I’m embarrassed to say it.

She was totally into it.

I told her that a more short-term goal is to make radical life-extension a reality- like, to the tune of 1000 years.

Again, absolute approval, she thought it was awesome.

She accepted my absurd, illogical goals, and I felt like I was accepted with them.

What I say to Amanda is my bond.

the-dbc-way (used chrome dev tools to find this image- hope that’s all right!)

I’m learning Ruby to prepare for Devbootcamp, an amazing program in San Francisco that creates world-class beginners in Ruby on Rails development. In Landmark, I recognized the courage to see that I am good enough to be a world-class creator whose tool is code.

In the wake of sharing my goals with Amanda, I committed to write a program that is useful to someone by Tuesday night(tonight), the final session of the forum. It’s my first step towards inspiring all of Humankind to see their own potential.

I couldn’t not do it.

This program is small, and it still has runtime errors, but I wrote it and it is mine.

It’s a command line program that simulates the experience of using flashcards. 

Since the only knowledge I had access to from Codeacademy’s Ruby tutorial was creating and manipulating data, printing to standard output, and getting input from the user, I was limited to what I could provide in a standalone program. Only programmers ever use the command line, and I don’t know much about the needs of advanced programmers, so I wrote something a beginner programmer could make use of.

Turns out, the person who’s going to make use of it is me! I’m going to be learning quite a bit about Ruby, and the more syntax I remember the fewer hours of debugging will be necessary. As I review a concept, I’m going to turn it into a flashcard in FlashcardEsque (my program), and once I have made flashcards of all my review topics, I’ll use the program to memorize them.

I already know what my next project is, once FlashcardEsque actually works :P  I’m writing a program that writes music.  That’s right, a computer writing music!

My friend Sam is really into artificially generated music, and it turns out you can write a music-writing program with almost any object-oriented language using very basic programming concepts.

Sam understands music theory and the logic of a music-writing program, but he doesn’t know Ruby. So while he can explain to me how the program should work, it will be up to me to write it in Ruby and make it useful! We’re whiteboarding our ideas in a google doc right now.

Once it’s done, he has a Haskell tool that will play the music my program writes.

I’m so excited to let people listen to the music my program creates.

Here’s FlashcardEsque version .01!

“#FlashcardEsque v.01, by David Stavis, 9/17/2013

#Written in Codeacademy<labs> with instruction from Codeacademy’s ruby tutorial

##Optional future improvements:

##include code that prevents the same cards from being chosen twice in a session

class Flashcard
def initialize(name, definition)

#has an instance variable ‘name’ that is a string

@name = name

#has an instance variable’definition’that is a string

@definition = definition


class Deck
#has an array called “cards” that holds flashcard objects

@cards = []

#has a method called “include” that adds a flashcard argument to the array of cards

def include(flashcard)

@cards << flashcard


#Everything below here is global! No more classes.

#Content Instantiation

#create some flashcards and gives them names and definitions

card1 =“Name1”, “Def1”)

card2 =“Name2”, “Def2”)

card3 =“Name3”, “Def3”)

#create a Deck and fill it with cards

the_deck =




#end Content Instantiation

#has a method called “choose” that grabs a flashcard at random and returns it

def choose

#creates a random number whose max is the number of items in the deck’s “cards” array – 1

#saves the random number to a variable called “card_index”

card_index = the_deck.@cards.length – 1

#returns the item in the array at position “card_index”



#has a method called “serve” that puts the name of a flashcard to standard output, then waits for any input using gets(effectively asking for an Enter key), then puts the definition

def serve(flashcard)

puts flashcard.@name

puts “Press Enter when ready”


puts flashcard.@definition


# has a method “start” that contains a loop that does the following

def start

# calls choose and saves its result as “chosen_card”,

chosen_card = choose

# then calls “serve” and passes the “chosen_card” as an argument.



#Here’s the program actually running! well, below here.

#puts an introduction to the purpose of the program and how it is used to the console

puts “Hi, I’m a flashcard-esque command line program.”

puts “press Enter to begin reviewing flashcards”

#on Enter(faked with gets), calls start (5 times for the purpose of seeing that this works)


5.times start



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: