Making a small grid
This is a problem set. Some of these are easy, others are far more difficult. The purpose of these problems sets are to HELP YOU THINK THROUGH problems. The solution is at the bottom of this page, but please don't look at it until you have tried (and failed) at least three or four times.
The Problem[edit]
This problem is designed to test your skill and knowledge of functions, variables and computational thinking.
You have a simple 25 x 25 grid. You can move up, down, left and right. Add:
- terrain
- a bad guy
- combat
- basic AI
- basic statistics for the bad guy (or you) like Hit Points, Armour, Power, etc...
Some Code to Get You Started[edit]
import random
grid = []
# let's make our map.We assume a 25 x 25 map
for i in range(0,625):
grid.append(random.randrange(1,4))
def draw_board():
row = 0
for i in range(0,625):
print str(i).zfill(3),
row = row + 1
if row == 25:
print ("\n")
row = 0
return
draw_board()
Take This Farther[edit]
You want to go farther?
- add color to this.
- add many types of different entities (google nethack)
- add an option to SAVE / RESTORE a game
How you will be assessed[edit]
Every problem set is a formative assignment. Please click here to see how you will be graded