In [1]:
%matplotlib inline
In [2]:
import numpy as np
from functools import partial
from sokoenginepy.variant import SokobanBoard
from sokoenginepy.core import INDEX, X, Y
import networkx as nx
In [3]:
board_str = "\n".join([
#0123456789012345678
" #####", # 0
" # #", # 1
" #$ #", # 2
" ### $##", # 3
" # $ $ #", # 4
"### # ## # ######", # 5
"# # ## ##### ..#", # 6
"# $ $ ..#", # 7
"##### ### #@## ..#", # 8
" # #########", # 9
" #######", # 10
])
vb = SokobanBoard(board_str = board_str)
In [5]:
pos = {}
for i in vb._graph._graph.nodes_iter():
pos[i] = (X(i, vb.width), -1*Y(i, vb.width,))
In [6]:
nx.draw_networkx(vb._graph, node_shape='s', pos=pos)
In [6]:
nx.draw_networkx_edges(vb._graph._graph, node_shape='s', pos=pos)
Out[6]: