Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Thomas Perkins
Thomas Perkins
496 Points

Solitaire Game.

Alright, I've decided I'm going to create an app, I've learned a lot and now is the time for me to put my training into action, I have an idea of what I want to do. I'm going to make a game similar to solitaire the only problem is I have no idea how to start this or even how to begin...

So my question is, how would you start if you where going to create a game like what I'm doing? Would you use classes, a superclass, just variables, methods etc.? I'm trying to get a grasp on what I want to accomplish within this game. I've made games already (just text games though "You walk through a door, what do you want to do?" gets.chomp! etc..)

So I'm looking for all possible solutions and looking very deep into how this will work and how this is going to be achieved I want to learn something from this experience. Please give examples of what you would personally use.

Thank you ahead of time!!

1 Answer

Adam Sommer
Adam Sommer
62,470 Points

I guess it depends somewhat on what language you're going to use, but one place you could start is by modeling the cards. Basically create a card class with attributes of a card:

  • number_value
  • name
  • image (maybe)

In a general sense a game is a big loop so that could be your next target:

  • Game starts.
  • Card is played
  • Is card played correctly?
  • If yes stack card/if no return card
  • Are all cards played?
  • If yes game is over/if no play another card.

There are some new courses on game development that might be useful. Also, some of the python courses walk through simple text games. Those might be useful in a high level sense to point you in a direction to start.

Happy developing!

Thomas Perkins
Thomas Perkins
496 Points

I'm trying to use only Ruby, one of my programmer friends pointed me in the direction of this: https://www.libgosu.org/

That should take care of the graphics, but I'm lost as to how I would even begin to develop this, I get what you're saying

number_value name image (maybe)

Game starts.
Card is played
Is card played correctly?
If yes stack card/if no return card
Are all cards played?
If yes game is over/if no play another card.

But idk the correct syntax for this I guess is what I'm trying to say..