Making a small grid

From Computer Science Wiki
This a problem set for you to work through [1]

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),end=' ')
        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]

Your solution will be graded using the following axis:


Scope

  • To what extent does your code implement the features required by our specification?
  • To what extent is there evidence of effort?

Correctness

  • To what extent did your code meet specifications?
  • To what extent did your code meet unit tests?
  • To what extent is your code free of bugs?

Design

  • To what extent is your code written well (i.e. clearly, efficiently, elegantly, and/or logically)?
  • To what extent is your code eliminating repetition?
  • To what extent is your code using functions appropriately?

Style

  • To what extent is your code readable?
  • To what extent is your code commented?
  • To what extent are your variables well named?
  • To what extent do you adhere to style guide?

References[edit]