Skip to content

Commit e7d0a2c

Browse files
MarkKoz64json
authored andcommitted
Implement Array2DTracer
1 parent ab1aa47 commit e7d0a2c

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed
Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
1-
from algorithm_visualizer import Tracer
1+
from typing import List
2+
3+
from algorithm_visualizer import Tracer, _Serializable
24

35
class Array2DTracer(Tracer):
4-
pass
6+
def set(self, array2d: List[List[_Serializable]] = None):
7+
if array2d is None:
8+
array2d = []
9+
self.command("set", array2d)
10+
11+
def patch(self, x: int, y: int, v: _Serializable = None):
12+
self.command("patch", x, y, v)
13+
14+
def depatch(self, x: int, y: int):
15+
self.command("depatch", x, y)
16+
17+
def select(self, sx: int, sy: int, ex: int = None, ey: int = None):
18+
if ex is None:
19+
ex = sx
20+
if ey is None:
21+
ey = sy
22+
self.command("select", sx, sy, ex, ey)
23+
24+
def selectRow(self, x: int, sy: int, ey: int):
25+
self.command("selectRow", x, sy, ey)
26+
27+
def selectCol(self, y: int, sx: int, ex: int):
28+
self.command("selectCol", y, sx, ex)
29+
30+
def deselect(self, sx: int, sy: int, ex: int = None, ey: int = None):
31+
if ex is None:
32+
ex = sx
33+
if ey is None:
34+
ey = sy
35+
self.command("deselect", sx, sy, ex, ey)
36+
37+
def deselectRow(self, x: int, sy: int, ey: int):
38+
self.command("deselectRow", x, sy, ey)
39+
40+
def deselectCol(self, y: int, sx: int, ex: int):
41+
self.command("deselectCol", y, sx, ex)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy