Miscellaneous scripts
This repository contains miscellaneous scripts that does not fit in one repository, yet I will use them sometimes for my personal use. Note that some of the scripts might contain hardcoded paths and opinionated presets, and you are advised to inspect them before actually using.
Loading...
Searching...
No Matches
planks Namespace Reference

Functions

bool passable (list[list] bridge)

Variables

list example

Detailed Description

Tasks:
Given an array:
[   [1, 1, 1, 1, 0],
    [0, 0, 0, 1, 0],
    [0, 1, 1, 1, 0],
    [0, 1, 0, 0, 0],
    [0, 1, 1, 1, 1]
]
representing the following situation:
(where O is wooden planks, X means water)
|    0000X    |
|    XXX0X    |
|    X000X    |
|    X0XXX    |
|    X0000    |
Where a guy starting from the left side, walk on the wooden planks
to arrive at the right side.
You can say the wooden planks forms a bridge,
and in the above situation, the bridge is "passable", aka you can
walk from the left side to the right side via the bridge.

Write a function that receives an 2-dimensional array as input, return a boolean
value (True/False) indicating whether the bridge is "passable".

Using recursion is strongly recommended.
COMP2113 [2023 Sem2] Assignment 3 Q2

Function Documentation

◆ passable()

bool planks.passable ( list[list] bridge)

Definition at line 38 of file planks.py.

38def passable(bridge: list[list]) -> bool:
39 # define your own function parameters and code
40 return False
41
42

References passable().

Referenced by passable().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ example

list planks.example
Initial value:
1= [[1, 1, 1, 1, 0],
2 [0, 0, 0, 1, 0],
3 [0, 1, 1, 1, 0],
4 [0, 1, 0, 0, 0],
5 [0, 1, 1, 1, 1]
6 ]

Definition at line 30 of file planks.py.