(It's also tempting to squish them all into one big binary number and do everything bitwise, but working without bitwise addressing would probably make life harder.) Sooner or later we need to flip and rotate these pieces, and one advantage of this method is that to rotate we just shift all the digits along by four. Though string manipulation is temptingly easy I immediately split these into arrays of zeros and ones. There are five bits to a side, but the corner bits are shared with the other sides, so they overlap. The reasoning was that this is easiest to enter: I could just pick up a piece and type it in quickly, and if the notation doesn't work out we can convert it later. I went for one string of zeros and ones as my initial notation, starting at the top left corner of a piece and working clockwise. There's a tradeoff between being efficient, being easy to enter, and being easy to use and think about. The first thing to decide is how to represent the pieces in memory. I immediately turned to javascript because I'm comfortable with it and in my experience, thanks to the millions that have been poured into it, it's much faster than other scripting languages. Well the suggestion was made to find the solution using computers, and so out came the laptops and the coding began. That's really hard to brute force, because you've got the biggest number of pieces available, and the smallest structure to build. But there were more challenges listed in the instruction book, such as cuboids, one big cube, a podium shape, and – one that caught my eye, because it was labelled as 'difficult' – one small cube using one piece of every colour. These things are deceptively simple-looking, and the hardest of the six colours took me a good bit of thinking to get together. This Christmas I was with a couple of friends and exposed for the first time to a little 3D jigsaw puzzle, a collection of EVA foam pieces that assemble into cubes.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |