TransWikia.com

Colored balls in a 4x4 grid

Puzzling Asked on December 19, 2020

Colored balls are placed in a 4×4 grid. A move consists of swapping two adjacent (horizontally or vertically) balls. What is the least number of moves required to form 4 connected components*, one for each color in the following grid?

enter image description here

*Here a connected component is a collection of balls of the same color, such that there is a path of horizontal or vertical steps from any ball to any other ball.

4 Answers

Correct answer by Retudin on December 19, 2020

Two pretty solutions with mirror and rotation symmetric outcomes:

Note on optimality:

Answered by Paul Panzer on December 19, 2020

Since the question does not request that all of the balls are part of a component, I will go with 3 moves.

YGBR
GBGR
RYGY
GBRR

to

YGBR
GYGR
RBGY
GBRR

to

YYBR
GGGR
RBGY
GBRR

and

YYBR
GGGR
RBGR
GBRY

Compenents are

YY B R
GGG R
R B G R
G B RY

If more than 4 components are allowed, the last step is not necessary, and the total count is 2.

Answered by SJuan76 on December 19, 2020

This can be done in

which I believe is pretty close to optimal, if not already.

Denoting the four colors as R, G, B, Y respectively, the initial state is

Y G B R
G B G R
R Y G Y
G B R R

Now,

Then,

Finally,

Answered by Bubbler on December 19, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP