Skip to content

Commit e646ee7

Browse files
author
lucifer
committed
feat: 更新可视化编辑文档
1 parent 1e842a1 commit e646ee7

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

‎src/visualDebug/README.md

+23-2
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ class Solution:
5656

5757
for i in range(n):
5858
# @pointer(nums)
59-
# 看���上面的注解会插入一行
59+
# 3. 看到上面的注解会插入一行
6060
left = i + 1
6161
drawGraph({ pointer: {
6262
nums: left
6363
}}, nums, target)
6464
# @pointer(nums)
65-
# 看到上面的注解会插入一行
65+
# 4. 看到上面的注解会插入一行
6666
right = n - 1
6767
drawGraph({ pointer: {
6868
nums: right
@@ -81,14 +81,35 @@ class Solution:
8181
return res
8282
```
8383

84+
第一步之后大概会生成这样的图:
85+
86+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfu805nd4mj30ol07taag.jpg)
87+
88+
第二步之后大概会生成这样的图:
89+
90+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfu7zjlxbfj30lr056wes.jpg)
91+
92+
第三步之后大概会生成这样的图:
93+
94+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfu813p4tij30m208d74s.jpg)
95+
96+
第四步之后大概会生成这样的图:
97+
98+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gfu81iyc9rj30qh0an750.jpg)
99+
100+
之后每次当 left 和 right 发生变化的时候更新图片(指针变化)即可。
101+
84102
drawGraph 的伪代码:
85103

86104
```py
105+
def makeObseravle(any, cb):
106+
if changed(any): cb
87107
def draw(options, shape):
88108
if is_array(shape) {
89109
pointer = options.pointer[shape.getName()]
90110
if :
91111
pointTo(shape, pointer)
112+
makeObseravle(pointer, draw)
92113
}
93114
if ...
94115
def drawGraph(options, ...shapes):

0 commit comments

Comments
 (0)