donnemartin / donnemartin/interactive-coding-challenges

draw-line challenge bug

Open
#297 1 comment 0 reactions 0 assignees View on GitHub
needs-review
Dominant language
Python
Stars
31.8k
Forks
4.7k
PR merge metrics
No merged PRs in 30d

Description

Using the drawline method provided as the solution, it does not handle cases where `start_byte != end_byte` properly. In `end_byte`, only the LSB is set.

E.g.

```
S = BitsScreen()
screen = []
for _ in range(20):
screen.append(int('00000000', base=2))
S.draw_line(screen, 32, 68, 92)
for row in screen:
print(f"{row: 09b}")
```

results in

```
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00001111
11111111
11111111
00001000 <---only bit corresponding to x2 = 92 is set
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000

```
I have tried to come up with a solution for this but could not. Could anyone provide the correct solution perhaps?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.