AnswerBun.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!

Related Questions

An Evil Cartesian Psycho

0  Asked on July 5, 2021

   

My Latest Password

1  Asked on July 4, 2021

   

Cut the string!

1  Asked on June 30, 2021 by rahim

     

What is a Complete Word™?

3  Asked on June 30, 2021 by jack-pettinger

   

My prefix is a lie

1  Asked on June 30, 2021

     

A family of seven!

1  Asked on June 30, 2021

   

Decoding a mystery sequence of falling boulders

0  Asked on June 29, 2021 by geotheory

 

What Am I? Alive Without Breath

1  Asked on June 28, 2021 by the-jokester

   

God, I’m so bad with names

3  Asked on June 28, 2021 by spandan

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP