Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #6698

Re: Rubik's cube

From Tim Harig <timharig@eternal-september.org>
Newsgroups comp.programming
Subject Re: Rubik's cube
Date 2016-07-01 16:19 +0000
Organization A noiseless patient Spider
Message-ID <nl655q$su0$1@dont-email.me> (permalink)
References <4c721d5f-f64e-4d2e-aabb-a49bf5588075@googlegroups.com>

Show all headers | View raw


On 2016-07-01, G G <gdotone@gmail.com> wrote:
> a 3 X 3 X 3 array
>    fixed sized not growing or shrinking so an array is 
>    a reasonable data representation?

I wrote a rubik's cube simulator using a graph network.

> question the only way a to change a position of a 
>    piece  is through rotation?
> - so matrix mathematics to handle the rotations?

For my graph network, you simply walked around one set of vertexes and changed
where the edges pointered. The hard part was keeping track of which
direction each vertex reference was pointing as it was shuffled around.  I
had to create a notation system for referring to which edge was pointed
where, and since my notation was from a single angle, change the edge
direction names along with the references as they were shuffled around.

The labeling was not strickly necessary for the code but kept things
straight in my head.  I also created a model cube with numbered squares
so that I could quickly confirm that the transformations where done
correctly.

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Rubik's cube G G <gdotone@gmail.com> - 2016-07-01 02:21 -0700
  Re: Rubik's cube G G <gdotone@gmail.com> - 2016-07-01 02:28 -0700
  Re: Rubik's cube G G <gdotone@gmail.com> - 2016-07-01 07:40 -0700
  Re: Rubik's cube Tim Harig <timharig@eternal-september.org> - 2016-07-01 16:19 +0000
    Re: Rubik's cube G G <gdotone@gmail.com> - 2016-07-01 10:00 -0700
  Re: Rubik's cube Öö Tiib <ootiib@hot.ee> - 2016-07-17 07:39 -0700
    Re: Rubik's cube BartC <bc@freeuk.com> - 2016-07-18 00:39 +0100

csiph-web