BLOCK x3 (Version 4) - MATLAB Cody - MATLAB Central

Problem 2511. BLOCK x3 (Version 4)

Difficulty:Rate

Always in this series ( 2451, 2484, and 2478 ).

Now we are in color (1 for red and 2 for white). Your task is always to count the minimum number of movements required to align the 3 blocks in each colors (vertically or horizontally).

  • [0 0 0 0 0 0 0;
  • 0 0 1 2 0 0 0;
  • 0 0 0 0 0 0 0;
  • 0 0 1 2 0 0 0;
  • 0 0 1 2 0 0 0;
  • 0 0 0 0 0 0 0;
  • 0 0 0 0 0 0 0]

In this example you can move down the first two blocks ( in two moves ).

Note that blocks can be swapped .

In this second example :

  • [0 0 0 0 0 0 0;
  • 0 0 0 0 0 0 0;
  • 0 0 1 2 0 0 0;
  • 0 0 2 1 0 0 0;
  • 0 0 1 2 0 0 0;
  • 0 0 0 0 0 0 0;
  • 0 0 0 0 0 0 0]

Here you win in only one move by swapping the two central blocks.

Good luck !

Solution Stats

100.0% Correct | 0.0% Incorrect
Last Solution submitted on Mar 07, 2024

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
13
5

Problem Recent Solvers5

Suggested Problems

More from this Author43

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page