Professional Documents
Culture Documents
Breadth First Search: # List For Visited Nodes. #Initialize A Queue #Function For BFS
Breadth First Search: # List For Visited Nodes. #Initialize A Queue #Function For BFS
# Driver Code
print("Following is the Breadth-First Search")
bfs(visited, graph, '5') # function calling
1 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [2]:
# Using a Python dictionary to act as an adjacency list
graph = {
'5' : ['3','7'],
'3' : ['2', '4'],
'7' : ['8'],
'2' : [],
'4' : ['8'],
'8' : []
}
# Driver Code
print("Following is the Depth-First Search")
dfs(visited, graph, '5')
N Queen Problem
2 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [3]:
# Python program to solve N Queen
# Problem using backtracking
global N
N = 4
def printSolution(board):
for i in range(N):
for j in range(N):
print (board[i][j],end=' ')
print()
return True
if isSafe(board, i, col):
# Place this queen in board[i][col]
board[i][col] = 1
3 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
if solveNQUtil(board, 0) == False:
print ("Solution does not exist")
return False
printSolution(board)
return True
0 0 1 0
1 0 0 0
0 0 0 1
0 1 0 0
Out[3]: True
4 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [ ]:
x = 4
y = 3
z = 2
def gcd(a, b):
if(b == 0):
return a
return gcd(b, a % b)
else:
return False
else:
return False
5 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [ ]:
from collections import deque
m = {}
isSolvable = False
path = []
# Current state
u = q.popleft()
if (u[0] == target):
if (u[1] != 0):
6 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
# Empty Jug2
q.append([a, 0])
# Empty Jug1
q.append([0, b])
# Driver code
if __name__ == '__main__':
8 Puzzle Problem
7 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [4]:
# Python3 program to print the path from root
# node to destination node for N*N-1 puzzle
# algorithm using Branch and Bound
# The solution assumes that instance of
# puzzle is solvable
# Constructor to initialize a
# Priority Queue
def __init__(self):
self.heap = []
# Node structure
class node:
8 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
self.mat = mat
count = 0
for i in range(n):
for j in range(n):
if ((mat[i][j]) and
(mat[i][j] != final[i][j])):
count += 1
return count
for i in range(n):
for j in range(n):
print("%d " % (mat[i][j]), end = " ")
9 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
print()
if root == None:
return
printPath(root.parent)
printMatrix(root.mat)
print()
10 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
if isSafe(new_tile_pos[0], new_tile_pos[1]):
# Driver Code
# Initial configuration
# Value 0 is used for empty space
initial = [ [ 1, 2, 3 ],
[ 5, 6, 0 ],
[ 7, 8, 4 ] ]
1 2 3
5 6 0
7 8 4
1 2 3
5 0 6
7 8 4
1 2 3
5 8 6
7 0 4
1 2 3
5 8 6
0 7 4
11 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [2]:
def printBoard(board):
print(board[1] + '|' + board[2] + '|' + board[3])
print('-+-+-')
print(board[4] + '|' + board[5] + '|' + board[6])
print('-+-+-')
print(board[7] + '|' + board[8] + '|' + board[9])
print("\n")
def spaceIsFree(position):
if board[position] == ' ':
return True
else:
return False
return
else:
print("Can't insert there!")
position = int(input("Please enter new position: "))
insertLetter(letter, position)
return
def checkForWin():
if (board[1] == board[2] and board[1] == board[3] and board[1] != ' '):
return True
elif (board[4] == board[5] and board[4] == board[6] and board[4] != ' '):
return True
elif (board[7] == board[8] and board[7] == board[9] and board[7] != ' '):
return True
elif (board[1] == board[4] and board[1] == board[7] and board[1] != ' '):
return True
elif (board[2] == board[5] and board[2] == board[8] and board[2] != ' '):
return True
elif (board[3] == board[6] and board[3] == board[9] and board[3] != ' '):
return True
elif (board[1] == board[5] and board[1] == board[9] and board[1] != ' '):
12 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
( ):
return True
elif (board[7] == board[5] and board[7] == board[3] and board[7] != ' '):
return True
else:
return False
def checkWhichMarkWon(mark):
if board[1] == board[2] and board[1] == board[3] and board[1] == mark:
return True
elif (board[4] == board[5] and board[4] == board[6] and board[4] == mark):
return True
elif (board[7] == board[8] and board[7] == board[9] and board[7] == mark):
return True
elif (board[1] == board[4] and board[1] == board[7] and board[1] == mark):
return True
elif (board[2] == board[5] and board[2] == board[8] and board[2] == mark):
return True
elif (board[3] == board[6] and board[3] == board[9] and board[3] == mark):
return True
elif (board[1] == board[5] and board[1] == board[9] and board[1] == mark):
return True
elif (board[7] == board[5] and board[7] == board[3] and board[7] == mark):
return True
else:
return False
def checkDraw():
for key in board.keys():
if (board[key] == ' '):
return False
return True
def playerMove():
position = int(input("Enter the position for 'X': "))
insertLetter(player, position)
return
def compMove():
bestScore = -800
bestMove = 0
for key in board.keys():
if (board[key] == ' '):
board[key] = bot
score = minimax(board, 0, False)
board[key] = ' '
if (score > bestScore):
bestScore = score
bestMove = key
insertLetter(bot, bestMove)
return
13 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
return 1
elif (checkWhichMarkWon(player)):
return -1
elif (checkDraw()):
return 0
if (isMaximizing):
bestScore = -800
for key in board.keys():
if (board[key] == ' '):
board[key] = bot
score = minimax(board, depth + 1, False)
board[key] = ' '
if (score > bestScore):
bestScore = score
return bestScore
else:
bestScore = 800
for key in board.keys():
if (board[key] == ' '):
board[key] = player
score = minimax(board, depth + 1, True)
board[key] = ' '
if (score < bestScore):
bestScore = score
return bestScore
printBoard(board)
print("You go first! Don't worry you will not lose provided you use your brain ")
print("Positions are as follow:")
print("1, 2, 3 ")
print("4, 5, 6 ")
print("7, 8, 9 ")
print("\n")
player = 'X'
bot = 'O'
n=0
| |
-+-+-
| |
-+-+-
| |
You go first! Don't worry you will not lose provided you use your brain
Positions are as follow:
14 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
1, 2, 3
4, 5, 6
7, 8, 9
X| |
-+-+-
|O|
-+-+-
| |
X| |
-+-+-
X|O|
-+-+-
O| |
X|O|X
-+-+-
X|O|
-+-+-
O| |
X|O|X
-+-+-
X|O|
-+-+-
15 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
O|O|X
Bot wins!
16 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [1]:
def iterative_deepening_dfs(start, target):
# Start by doing DFS with a depth of 1, keep doubling depth until we reach the "bottom" of
depth = 1
bottom_reached = False # Variable to keep track if we have reached the bottom of the tree
while not bottom_reached:
# One of the "end nodes" of the search with this depth has to still have children and
result, bottom_reached = iterative_deepening_dfs_rec(start, target, 0, depth)
if result is not None:
# We've found the goal node while doing DFS with this max depth
return result
# We haven't found the goal node, but there are still deeper nodes to search through
depth *= 2
print("Increasing depth to " + str(depth))
if node["value"] == target:
# We have found the goal node we we're searching for
print("Found the node we're looking for!")
return node, True
if current_depth == max_depth:
print("Current maximum depth reached, returning...")
# We have reached the end for this depth...
if len(node["children"]) > 0:
# ...but we have not yet reached the bottom of the tree
return None, False
else:
return None, True
# We've gone through all children and not found the goal node
return None, bottom_reached
In [ ]:
18 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [2]:
class Node:
def __init__(self,data,level,fval):
""" Initialize the node with the data, level of the node and the calculated fvalue """
self.data = data
self.level = level
self.fval = fval
def generate_child(self):
""" Generate child nodes from the given node by moving the blank space
either in the four directions {up,down,left,right} """
x,y = self.find(self.data,'_')
""" val_list contains position values for moving the blank space in either of
the 4 directions [up,down,left,right] respectively. """
val_list = [[x,y-1],[x,y+1],[x-1,y],[x+1,y]]
children = []
for i in val_list:
child = self.shuffle(self.data,x,y,i[0],i[1])
if child is not None:
child_node = Node(child,self.level+1,0)
children.append(child_node)
return children
def shuffle(self,puz,x1,y1,x2,y2):
""" Move the blank space in the given direction and if the position value are out
of limits the return None """
if x2 >= 0 and x2 < len(self.data) and y2 >= 0 and y2 < len(self.data):
temp_puz = []
temp_puz = self.copy(puz)
temp = temp_puz[x2][y2]
temp_puz[x2][y2] = temp_puz[x1][y1]
temp_puz[x1][y1] = temp
return temp_puz
else:
return None
def copy(self,root):
""" Copy function to create a similar matrix of the given node"""
temp = []
for i in root:
t = []
for j in i:
t.append(j)
temp.append(t)
return temp
def find(self,puz,x):
""" Specifically used to find the position of the blank space """
for i in range(0,len(self.data)):
for j in range(0,len(self.data)):
if puz[i][j] == x:
return i,j
class Puzzle:
def __init__(self,size):
""" Initialize the puzzle size by the specified size,open and closed lists to empty ""
self.n = size
19 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
self.open = []
self.closed = []
def accept(self):
""" Accepts the puzzle from the user """
puz = []
for i in range(0,self.n):
temp = input().split(" ")
puz.append(temp)
return puz
def f(self,start,goal):
""" Heuristic Function to calculate hueristic value f(x) = h(x) + g(x) """
return self.h(start.data,goal)+start.level
def h(self,start,goal):
""" Calculates the different between the given puzzles """
temp = 0
for i in range(0,self.n):
for j in range(0,self.n):
if start[i][j] != goal[i][j] and start[i][j] != '_':
temp += 1
return temp
def process(self):
""" Accept Start and Goal Puzzle state"""
print("Enter the start state matrix \n")
count = 0
start = self.accept()
print("Enter the goal state matrix \n")
goal = self.accept()
start = Node(start,0,0)
start.fval = self.f(start,goal)
""" Put the start node in the open list"""
self.open.append(start)
print("\n\n")
while True:
if count>20:
break
cur = self.open[0]
print("")
print(" | ")
print(" | ")
print(" \\\'/ \n")
for i in cur.data:
for j in i:
print(j,end=" ")
print("")
count+=1
""" If the difference between current and goal node is 0 we have reached the goal
if(self.h(cur.data,goal) == 0):
break
for i in cur.generate_child():
i.fval = self.f(i,goal)
self.open.append(i)
self.closed.append(cur)
del self.open[0]
20 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
puz = Puzzle(3)
puz.process()
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-2-21cc37f20a1e> in <module>
122
123 puz = Puzzle(3)
--> 124 puz.process()
125
<ipython-input-2-21cc37f20a1e> in process(self)
85 print("Enter the start state matrix \n")
86 count = 0
---> 87 start = self.accept()
88 print("Enter the goal state matrix \n")
89 goal = self.accept()
<ipython-input-2-21cc37f20a1e> in accept(self)
64 puz = []
65 for i in range(0,self.n):
---> 66 temp = input().split(" ")
67 puz.append(temp)
68 return puz
C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\kernelbase.py in raw_input(self,
prompt)
858 "raw_input was called, but this frontend does not support inp
ut requests."
859 )
--> 860 return self._input_request(str(prompt),
861 self._parent_ident,
862 self._parent_header,
C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\kernelbase.py in _input_request
(self, prompt, ident, parent, password)
902 except KeyboardInterrupt:
903 # re-raise KeyboardInterrupt, to truncate traceback
--> 904 raise KeyboardInterrupt("Interrupted by user") from None
905 except Exception as e:
906 self.log.warning("Invalid Message:", exc_info=True)
Burglary Alarm
21 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [3]:
# Import libraries
import pgmpy.models
import pgmpy.inference
import networkx as nx
import pylab as plt
# Create a bayesian network
model = pgmpy.models.BayesianNetwork([('Burglary', 'Alarm'),
('Earthquake', 'Alarm'),
('Alarm', 'JohnCalls'),
('Alarm', 'MaryCalls')])
# Define conditional probability distributions (CPD)
# Probability of burglary (True, False)
cpd_burglary = pgmpy.factors.discrete.TabularCPD('Burglary',2,[[0.001], [0.999]])
# Probability of earthquake (True, False)
cpd_earthquake = pgmpy.factors.discrete.TabularCPD('Earthquake', 2, [[0.002], [0.998]])
# Probability of alarm going of (True, False) given a burglary and/or earthquake
cpd_alarm = pgmpy.factors.discrete.TabularCPD('Alarm', 2, [[0.95, 0.94, 0.29, 0.001],
[0.05, 0.06, 0.71, 0.999]],
evidence=['Burglary', 'Earthquake'],
evidence_card=[2, 2])
# Probability that John calls (True, False) given that the alarm has sounded
cpd_john = pgmpy.factors.discrete.TabularCPD('JohnCalls', 2, [[0.90, 0.05],
[0.10, 0.95]],
evidence=['Alarm'],
evidence_card=[2])
# Probability that Mary calls (True, False) given that the alarm has sounded
cpd_mary = pgmpy.factors.discrete.TabularCPD('MaryCalls', 2, [[0.70, 0.01],
[0.30, 0.99]],
evidence=['Alarm'],
evidence_card=[2])
# Add CPDs to the network structure
model.add_cpds(cpd_burglary, cpd_earthquake, cpd_alarm, cpd_john, cpd_mary)
# Check if the model is valid, throw an exception otherwise
model.check_model()
# Print probability distributions
print('Probability distribution, P(Burglary)')
print(cpd_burglary)
print()
print('Probability distribution, P(Earthquake)')
print(cpd_earthquake)
print()
print('Joint probability distribution, P(Alarm | Burglary, Earthquake)')
print(cpd_alarm)
print()
print('Joint probability distribution, P(JohnCalls | Alarm)')
print(cpd_john)
print()
print('Joint probability distribution, P(MaryCalls | Alarm)')
print(cpd_mary)
print()
# Plot the model
nx.draw(model, with_labels=True)
# Perform variable elimination for inference
# Variable elimination (VE) is a an exact inference algorithm in bayesian networks
infer = pgmpy.inference.VariableElimination(model)
# Calculate the probability of a burglary if John and Mary calls (0: True, 1: False)
posterior_probability = infer.query(['Burglary'], evidence={'JohnCalls': 0, 'MaryCalls'
# Print posterior probability
22 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\networkx\utils\decorators.py in _random_st
ate(func, *args, **kwargs)
395 try:
--> 396 random_state_arg = args[random_state_index]
397 except TypeError as e:
23 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
The above exception was the direct cause of the following exception:
C:\ProgramData\Anaconda3\lib\site-packages\networkx\drawing\nx_pylab.py in draw(G, po
s, ax, **kwds)
121 kwds["with_labels"] = "labels" in kwds
122
--> 123 draw_networkx(G, pos=pos, ax=ax, **kwds)
124 ax.set_axis_off()
125 plt.draw_if_interactive()
C:\ProgramData\Anaconda3\lib\site-packages\networkx\drawing\nx_pylab.py in draw_netwo
rkx(G, pos, arrows, with_labels, **kwds)
331
332 if pos is None:
--> 333 pos = nx.drawing.spring_layout(G) # default to spring layout
334
335 draw_networkx_nodes(G, pos, **node_kwds)
C:\ProgramData\Anaconda3\lib\site-packages\networkx\utils\decorators.py in _random_st
ate(func, *args, **kwargs)
398 raise nx.NetworkXError("random_state_index must be an integer") f
rom e
399 except IndexError as e:
--> 400 raise nx.NetworkXError("random_state_index is incorrect") from e
401
402 # Create a numpy.random.RandomState instance
24 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
25 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
In [1]:
#! /usr/bin/env python3
import sys
import time
class Direction:
OLD_TO_NEW = 1
NEW_TO_OLD = 0
class CONST:
def _init_(self, MAX_M, MAX_C, CAP_BOAT, MAX_TIME_S, MAX_NODES):
self.MAX_M = MAX_M
self.MAX_C = MAX_C
self.CAP_BOAT = CAP_BOAT
self.MAX_TIME = MAX_TIME_S
self.MAX_NODES = MAX_NODES
MAX_M = 30
MAX_C = 30
CAP_BOAT = 20
CNST = None
class State(object):
self.moves = moves
global MAX_M
global MAX_C
global CAP_BOAT
global CNST
MAX_M = CONSTS.MAX_M
MAX_C = CONSTS.MAX_C
CAP_BOAT = CONSTS.CAP_BOAT
26 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
( ):
listChild = []
if not self.isValid() or self.isGoalState():
return listChild
if self.dir == Direction.OLD_TO_NEW:
sgn = -1
direction = "from the original shore to the new shore"
else:
sgn = 1
direction = "back from the new shore to the original shore"
for i in self.moves:
(m, c) = i
self.addValidSuccessors(listChild, m, c, sgn, direction)
return listChild
def isValid(self):
# obvious
if self.missionaries < 0 or self.cannibals < 0 or self.missionaries >
self.dir != 0 and self.dir != 1):
return False
return True
def isGoalState(self):
return self.cannibals == 0 and self.missionaries == 0 and self.dir ==
def _repr_(self):
return "\n%s\n\n< @Depth:%d State (%d, %d, %d, %d, %d) >" % (
self.action, self.level, self.missionaries, self.cannibals, self
self.cannibalsPassed)
def _hash_(self):
return hash((self.missionaries, self.cannibals, self.dir))
import time
27 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
class Graph:
def _init_(self):
self.bfs_parent = {}
self.dfs_parent = {}
self.expandedBFS = 0
self.expandedDFS = 0
start_time = time.time()
queue = [s]
while queue:
self.expandedBFS += 1
u = queue.pop(0)
if u.isGoalState():
print("No of Expanded Nodes: " + str(self.expandedBFS
print("No of Explored Nodes: " + str(visited._len_()))
queue.clear()
self.bfs_parent[TERMINAL_STATE] = u
return self.bfs_parent
for v in reversed(u.successors()):
if (v.missionaries, v.cannibals, v.dir) not in visited
self.bfs_parent[v] = u
v.level = u.level + 1
queue.append(v)
visited[(v.missionaries, v.cannibals, v.dir)]
return {}
start_time = time.time()
stack = [s]
while stack:
28 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
u = stack.pop()
self.expandedDFS += 1
if u.isGoalState():
print("No of Expanded Nodes: " + str(self.expandedDFS
print("No of Explored Nodes: " + str(visited._len_()))
self.dfs_parent[TERMINAL_STATE] = u
stack.clear()
return self.dfs_parent
t = time.time() - start_time
# Stops searching after a certain time/node limit
if t > u.CONSTANTS.MAX_TIME or self.expandedDFS > u.CONSTANTS
if t > u.CONSTANTS.MAX_TIME:
print("%.2fs EXCEEDED TIME LIMIT of %.2fs" %
else:
print("EXCEEDED NODE LIMIT of %d" % u.CONSTANTS
print("No of Expanded Nodes: " + str(self.expandedDFS
print("No of Explored Nodes: " + str(visited._len_()))
stack.clear()
return {}
for v in u.successors():
if (v.missionaries, v.cannibals, v.dir) not in visited
visited[(v.missionaries, v.cannibals, v.dir)]
self.dfs_parent[v] = u
stack.append(v)
return {}
stack = []
while stack:
print(stack.pop())
CON_IN = sys.stdin
CON_OUT = sys.stdout
# Generate All possible next moves for each state to reduce number of iterations on each node
def genPossibleMoves(CAP_BOAT):
moves = []
for m in range(CAP_BOAT + 1):
for c in range(CAP_BOAT + 1):
if 0 < m < c:
continue
if 1 <= m + c <= CAP_BOAT:
moves.append((m, c))
29 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
return moves
def main():
m = int(input("m="))
print(m, end="\n")
c = int(input("c="))
print(c, end="\n")
k = int(input("k="))
print(k, end="\n")
# t=10
t = int(10)
#print(t, end="\n")
n = int(100000)
#print(n, end="\n")
# t=10
# n=100000
CNST = CONST(m, c, k, t, n)
moves = genPossibleMoves(CNST.CAP_BOAT)
print(str(moves._len_())+" iterations per Node.")
g = Graph()
sys.stdout = CON_OUT
print("\nRunning BFS>")
runBFS(g, INITIAL_STATE)
sys.stdout = CON_OUT
print("Executed BFS>")
30 of 31 08-06-2022, 09:54
AI Complete File http://localhost:8888/nbconvert/html/ARTIFICIAL%20INTELLIGEN...
print("\nRunning DFS>")
runDFS(g, INITIAL_STATE)
sys.stdout = CON_OUT
print("Executed DFS>")
if _name_ == '_main_':
main()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-e68b64610b75> in <module>
110
111
--> 112 TERMINAL_STATE = State(-1, -1, Direction.NEW_TO_OLD, -1, -1, 0, CNST,None)
113 # INITIAL_STATE = State(MAX_M, MAX_C, Direction.OLD_TO_NEW, 0, 0, 0, CNST)
114
In [ ]:
31 of 31 08-06-2022, 09:54