lecture 1
lecture 1
Programming (CS2012)
Lecture 1
Programming
• Is challenging
• Could be fun
• Could be stressful
• Comes in many forms
• Is an essential knowledge pillar
Have you Done Any Programming?
Let’s Start a Simple Activity
• Simulate your own game
• Read the hand out and suggest a suitable
name for the game
• Identify the entities in this simulation
• Fill the character sheet for your warrior
How can We Implement this in
Python?
• I.E., only using what you learnt at first
semester
• Let’s consider warriors only
name = ‘Frodo’
category = ‘warrior’
type = ‘normal’
Immortality = False
inventory = {‘stick’:1, ‘binoculars’:0}
How can We Implement this in
Python?
playerNames = [‘Frodo’, ‘Samwise’, ‘Meriadoc‘]
categories = [‘warrior’, ‘warrior’, ‘warrrior’]
playerTypes = [‘normal’, ‘super’, ‘normal’]
playerInventories = [{‘stick’:1, ‘binoculars’:0},
{‘stick’:1, ‘binoculars’:1}, {‘stick’:1,
‘binoculars’:0}]
Object Oriented Programming
• Objects can be used effectively to represent real-
world entities
– Warriors, monsters, trees, binoculars…..