Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Wednesday, 9 October 2013

Game #001: Greeting

Github

Remember, my posts are like buses. You wait 10 months for one, then two come along straight away!

I have uploaded my first game. As I said in my first post, many of these will probably be a demo of something, rather than a full-on game. And this is no exception.

Greeting.py is a script which will ask you your name and then greet you. It's such a small script, I can post it in its entirety.


print ("Hi! What is your name? ")
name = input(">>> ")

print ("Welome " + name + "! I hope you enjoy your time browsing the 100 Games project.") 

The main feature of this script is to get the user's input. For games to be interactive, they require input of some kind from the user.
Obtaining the user's input is cunningly done via the input command. Whatever the user types in will be assigned to the variable name for use in the next line, the welcome statement.

Ways to enhance this script may be to only accept characters A-Z, filter out swear words using a dictionary, limit the number of characters a user can input. The list is endless! I will probably want to use some of the above ideas in later games when I interact with users in more complicated games.

P.S. I used the standard highlight function of blogger to make the code look code-y. I realise it looks a bit pants right now. Hopefully I can find a way to style the code snippets better in the future.
[Edit] Found it! Code highlighted

Tags for google+: #Python #100Games #Game

The 100 Games Project

Well, it looks like my idea about blogging more didn't really take off. 10 months on from my last post and here I am with the second article of 2013. Let’s see where we go from here.

100 Games Project

The title of this blog is the 100 Games Project. It is something I am trying which will hopefully help me to learn programming in a fun and interesting way.

Last week I noticed a tweet by Z. A. Shaw, who wrote "Learn Python the Hard Way", mentioning Jennifer Dewalt had finished her 180 Websites in 180 Days project. I remembered hearing about this a while back (probably from Shaw himself), and went to take a look. For the past week I have been reading Jennifer's blog, following the journey from her first website onwards. I was impressed by how she took an idea, and then used Stack Overflow, Google, and anything else to work out how to complete the idea. This lead to was Jennifer encountering more advanced technology (than HTML and CSS) such as jQuery and javascript a lot sooner than in most book lead courses on web development.
Reading the blog got me thinking about my own attempts to learn programming and how often I have got to a point in a course and then given up, got bored, or distracted by another language (where I have usually repeated the same process). The 100 Games Project aims to take Jennifer’s process of using ideas to direct learning to help me with my studies in learning to code.

I am currently learning Python through Udacity's Introduction to Computer Science course. So far I have really enjoyed the show a little, test a little way of presenting the language. Plus the idea of building a web crawler is appealing. I know, however, that if I don't do other things with my knowledge, it won't bed in and I will end up getting to a point where I struggle, get bored, and then stop. The 100 Games Project should go some way to keeping me interested, and bed the knowledge in.

Why 100 Games? 

100 games is quite a lot of games, for sure. I expect a lot of them will probably be more of a tech demo than an actual game. Other games will probably be incremental versions of past games. Even so, I will try and do something new (for me at least) with each game. If I revisit the majority of an old game, it will be to significantly change what was originally coded.
In the same way that Jennifer did, I will also blog a little bit about each game, and uploaded everything to github. That way there is a record
of each game, and other people can take them and play (with) them as well. It will also serve as a reminder of where I started and where I got to should I ever complete the project!

I realise I have now rambled on for quite long enough. If you have read this far, well done. Other posts will definitely not be as long. This I promise.