Issues surrounding the solution to the first four functions.
Summary Sat 14 May. There's a lot of confusion about what the functions do, especially the BMLmove/L functions. It's important that you understand that their goal is the same, which is to perform one transformation on TG, equivalent to one of the two steps shown in the example picture. The caller tells the function which car type to move, if you started with a counting algorithm then that was just practice, the real version makes changes to a copy of TG, which it then copies back. As it will take some of you a long time to puzzle through what to do in the loop version (BMLmoveL), I've posted pseudocode in an answer , you can use that but please try to understand what every line does.
For the vectorised BMLmove the key is understanding logical arrays and how if you want to look somewhere else in the grid relative to a certain cell you have to rotate (a copy of) the grid to the cell of interest coincides with the reference cell. Once you've got that idea, the whole solution is a few lines of Matlab without any ifs or loops.
BMLmove logic animation, Tue 17 May . Many people are having difficulty getting their head around a vectorised (LA) way to solve the BMLmove problem. Every step of the simplest algorithm is shown in this animation . You need an SVG-compliant browser such as Chrome, Safari or (maybe) Firefox for it to work properly.
Resource created Saturday 07 May 2016, 08:50:18 AM, last modified Tuesday 17 May 2016, 10:27:45 PM.