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.
|
Functions | |
bool | passable (list[list] bridge) |
Variables | |
list | example |
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
bool planks.passable | ( | list[list] | bridge | ) |
Definition at line 38 of file planks.py.
References passable().
Referenced by passable().