Exemple #1
0
def grade():
    grader = graderUtil.Grader()
    submission = grader.load('submission')

    # Avoid timeouts during later non-basic parts.
    grader.addPart('init', lambda: getRealCosts(), maxPoints=0, maxSeconds=15)

    add_parts_1(grader, submission)
    add_parts_2(grader, submission)
    add_parts_3(grader, submission)

    grader.grade()
Exemple #2
0
#!/usr/bin/env python3

import graderUtil

grader = graderUtil.Grader()
submission = grader.load('submission')

FINAL_GRADE = True
SEED = 'testing' # random seed at the beginning of each question for more fairness in grading...
BIG_NEGATIVE = -10000

from game import Agent
from ghostAgents import RandomGhost, DirectionalGhost
import random, math, traceback, sys, os

import pacman, time, layout, textDisplay
textDisplay.SLEEP_TIME = 0
textDisplay.DRAW_EVERY = 1000
thismodule = sys.modules[__name__]


def run(layname, pac, ghosts, nGames = 1, name = 'games'):
  """
  Runs a few games and outputs their statistics.
  """
  if grader.fatalError:
    return {'time': 65536, 'wins': 0, 'games': None, 'scores': [0]*nGames, 'timeouts': nGames}

  starttime = time.time()
  lay = layout.getLayout(layname, 3)
  disp = textDisplay.NullGraphics()