<jupyter_start><jupyter_text>Intelligent Systems Assignment 1 Masterball solver**Name:****ID:**  1. Create a class to model the Masterball problem A Masterball must be represented as an array of arrays with integer values representing the color of the tile in each position:A solved masterball must look like this:```python[ [0, 1, 2, 3, 4, 5, 6, 7],  [0, 1, 2, 3, 4, 5, 6, 7],  [0, 1, 2, 3, 4, 5, 6, 7],  [0, 1, 2, 3, 4, 5, 6, 7]]```  Variables modeling the actions<jupyter_code>'''
This variables MUST not be changed.
They represent the movements of the masterball.
'''
R_0 = "Right 0"
R_1 = "Right 1"
R_2 = "Right 2"
R_3 = "Right 3"

V_0 = "Vertical 0"
V_1 = "Vertical 1"
V_2 = "Vertical 2"
V_3 = "Vertical 3"
V_4 = "Vertical 4"
V_5 = "Vertical 5"
V_6 = "Vertical 6"
V_7 = "Vertical 7"<jupyter_output><empty_output><jupyter_text>`R_i` moves the `i`th row to the right. For instance, `R_2` applied to the solved state will produce:```python[ [0, 1, 2, 3, 4, 5, 6, 7],  [0, 1, 2, 3, 4, 5, 6, 7],  [7, 0, 1, 2, 3, 4, 5, 6],  [0, 1, 2, 3, 4, 5, 6, 7]]````V_i` performs a clockwise vertical move starting with the `i`th column`V_1` applied to the above state will produce:```python[ [0, 4, 3, 2, 1, 5, 6, 7],  [0, 3, 2, 1, 0, 5, 6, 7],  [7, 4, 3, 2, 1, 4, 5, 6],  [0, 4, 3, 2, 1, 5, 6, 7]]```  The Masterball problem class<jupyter_code>import search
class MasterballProblem(search.SearchProblem):    
    
    def __init__(self, startState):
        '''
        Store the initial state in the problem representation and any useful
        data.
        Here are some examples of initial states:
        [[0, 1, 4, 5, 6, 2, 3, 7], [0, 1, 3, 4, 5, 6, 3, 7], [1, 2, 4, 5, 6, 2, 7, 0], [0, 1, 4, 5, 6, 2, 3, 7]]
        [[0, 7, 4, 5, 1, 6, 2, 3], [0, 7, 4, 5, 0, 5, 2, 3], [7, 6, 3, 4, 1, 6, 1, 2], [0, 7, 4, 5, 1, 6, 2, 3]]
        [[0, 1, 6, 4, 5, 2, 3, 7], [0, 2, 6, 5, 1, 3, 4, 7], [0, 2, 6, 5, 1, 3, 4, 7], [0, 5, 6, 4, 1, 2, 3, 7]]
        '''
        self.expanded = 0
        ### your code here ###
        pass
    
    
    def isGoalState(self, state):
        '''
        Define when a given state is a goal state (A correctly colored masterball)
        '''
        ### your code here ###
        pass
    
    def getStartState(self):
        '''
        Implement a method that returns the start state according to the SearchProblem
        contract.
        '''
        ### your code here ###
        pass

    def getSuccessors(self, state):
        '''
        Implement a successor function: Given a state from the masterball
        return a list of the successors and their corresponding actions. 

        This method *must* return a list where each element is a tuple of 
        three elements with the state of the masterball in the first position,
        the action (according to the definition above) in the second position, 
        and the cost of the action in the last position. 

        Note that you should not modify the state.
        '''
        self.expanded += 1
        ### your code here ###
        pass<jupyter_output><empty_output><jupyter_text>2. Implement iterative deepening searchFollow the example code provided in class and implement iterative deepening search (IDS).<jupyter_code>def iterativeDeepeningSearch(problem):
    return []

def aStarSearch(problem, heuristic):
    return []<jupyter_output><empty_output><jupyter_text>Evaluate it to see what is the maximum depth that it could explore in a reasonable time. Report the results.   3. Implement different heuristics for the problem Implement at least two admissible and consistent heuristics. Compare A* using the heuristics against IDS calculating the number of expanded nodes and the effective branching factor, in the same way as it is done in figure 3.29 of [Russell10].<jupyter_code>def myHeuristic(state):
    return 0
def solveMasterBall(problem, search_function):
    '''
    This function receives a Masterball problem instance and a 
    search_function (IDS or A*S) and must return a list of actions that solve the problem.
    '''
    return []


problem = MasterballProblem([ [0, 4, 3, 2, 1, 5, 6, 7],
                              [0, 3, 2, 1, 0, 5, 6, 7],
                              [7, 4, 3, 2, 1, 4, 5, 6],
                              [0, 4, 3, 2, 1, 5, 6, 7]])

print solveMasterBall(problem, iterativeDeepeningSearch(problem))
print solveMasterBall(problem, aStarSearch(problem, myHeuristic))<jupyter_output>[]
[]
{'fraction_non_alphanumeric': 0.1259009009009009, 'fraction_numerical': 0.05900900900900901, 'mean_word_length': 2.8350604490500864, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '16280', 'license': 'MIT', 'n_tokens_mistral': 1715, 'n_tokens_neox': 1457, 'n_words': 639, 'path': 'masterball.ipynb', 'repo_name': 'ingJSNA/IS-assigment2', 'size': '4440'}