Stimulating Liquid Flow on Matrix
问题 I have to simulate a liquid flow through a square matrix that contains a set of integers. The liquid should start from the top left corner of the matrix. It could only move towards right or below adjacent matrix. The lower value of the adjacent matrix, the higher potential for it to flow. The movement of the liquid is considered stop at the right or below edge of the matrix. The program should be able to show the sum of all numbers that the liquid has passed through. import numpy as np mtr=