-
Notifications
You must be signed in to change notification settings - Fork 1
/
Agent.py
executable file
·48 lines (45 loc) · 2.29 KB
/
Agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Your Agent for solving Raven's Progressive Matrices. You MUST modify this file.
#
# You may also create and submit new files in addition to modifying this file.
#
# Make sure your file retains methods with the signatures:
# def __init__(self)
# def Solve(self,problem)
#
# These methods will be necessary for the project's main method to run.
# Install Pillow and uncomment this line to access image processing.
#from PIL import Image
from solver_utils import solve_problem
class Agent:
# The default constructor for your Agent. Make sure to execute any
# processing necessary before your Agent starts solving problems here.
#
# Do not add any variables to this signature; they will not be used by
# main().
def __init__(self):
pass
# The primary method for solving incoming Raven's Progressive Matrices.
# For each problem, your Agent's Solve() method will be called. At the
# conclusion of Solve(), your Agent should return an integer representing its
# answer to the question: "1", "2", "3", "4", "5", or "6". These integers
# are also the Names of the individual RavensFigures, obtained through
# RavensFigure.getName() (as Strings).
#
# In addition to returning your answer at the end of the method, your Agent
# may also call problem.checkAnswer(int givenAnswer). The parameter
# passed to checkAnswer should be your Agent's current guess for the
# problem; checkAnswer will return the correct answer to the problem. This
# allows your Agent to check its answer. Note, however, that after your
# agent has called checkAnswer, it will *not* be able to change its answer.
# checkAnswer is used to allow your Agent to learn from its incorrect
# answers; however, your Agent cannot change the answer to a question it
# has already answered.
#
# If your Agent calls checkAnswer during execution of Solve, the answer it
# returns will be ignored; otherwise, the answer returned at the end of
# Solve will be taken as your Agent's answer to this problem.
#
# Make sure to return your answer *as an integer* at the end of Solve().
# Returning your answer as a string may cause your program to crash.
def Solve(self,problem):
return solve_problem(problem)