3D Unblock Cube

Kristen Olsen 
kmvolsen45@gmail.com
Math 213 -- Mathematics with Mathematica, Fall 2009 
December 3, 2009

Abstract

My project recreates a game puzzle but in a 3D form. I used some functions we have already praticed with and combined them to make a puzzle.

Section 1. Introduction

1.1 Background

Looking through the different examples of games we were able to investigate I thought of a game that I like to play called unblock. I began with the idea of making the game the same way that it is normally played. After a few tries I concluded that using 3D cubes maybe a better approach.

1.2 Problem Statement

The Problem Statement I began with was how to recreate the game unblock in Mathematica

1.3 Useful Commands

Some of the commands that were useful in the creation of my project were Manipulate, Cuboid, and the different color commands. The color commands became very useful in distinguishing the cuboids from one another. Two of the color commands that I used were Darker and Light both took one of the standard colors used in Mathematica and changed it to a different shade of the color. Another command I learned about was EdgeForm, this command makes a outline of the cuboid in a solid color.

Section 2. Main Work

2.1 Positioning the Different Squares

I start with small cubes in each corner to figure out the different coordinates of each cuboid. I use different colors for each cube to not make it confusing.

Graphics3D[{Black, Cuboid[{1,1,1}],Pink,Cuboid[{0,0,0}], Orange, Cuboid[{2,2,2}], Blue,Cuboid[{0,0,2}],Yellow, Cuboid[{2,0,0}], Purple, Cuboid[{0,2,0}], Green, Cuboid[{0,2,2}], Brown,Cuboid[{2,0,2}],Darker[Blue] , Cuboid[{2,2,0}]}]

2.2 Making each cuboid into larger cubes (most rectangles)

Now I begin to try different cooridates to place each cube in its start postion. I have to make sure that none of the blocks will be on top of eachother. Next I have  The final product shows that no side is left open where the black cube can escape. Also in this step I add the EdgeForm function which makes it easier see if the blocks start to overlap.

Graphics3D[{EdgeForm[Thick],
Black,Cuboid[{1,1,1}],
Pink,Cuboid[{0,0,0},{2,1,1}],
Blue,Cuboid[{1,2,2},{2,3,0}],
Red,Cuboid[{1,0,2},{2,2,3}],
Yellow,Cuboid[{2,0,0},{3,2,1}],
Darker[Green],Cuboid[{0,3,1},{1,1,2}],
Orange,Cuboid[{2,2,2},{0,3,3}],
Brown,Cuboid[{2,0,1},{3,2,2}],
Purple,Cuboid[{2,2,0},{0,1,1}],
LightBlue,Cuboid[{0,0,1},{2,1,2}],
Darker[Blue], Cuboid[{0,0,2}]}]

2.3 Moving the Black Cube out

The final step is to Manipulate the cubes in an order in which the black cube will touch the black square on one of the sides. After you have completed this step you have completed the puzzle.

Manipulate[Graphics3D[{EdgeForm[Thick],
Black,Cuboid[{1,1,1+x}],
Pink,Cuboid[{0+p,0,0},{2+p,1,1}],
Blue,Cuboid[{2+b,2,2},{3+b,3,0}],
Red,Cuboid[{1+r,0,2},{2+r,2,3}],
Yellow,Cuboid[{2,0,0+y},{3,2,1+y}],
Darker[Green],Cuboid[{0,3+dg,1},{1,1+dg,2}],
Orange,Cuboid[{2+o,2,2},{0+o,3,3}],
Brown,Cuboid[{2,0,1+bw},{3,2,2+bw}],
Purple,Cuboid[{2,2,0},{0,1,1}],
LightBlue,Cuboid[{0+lb,0,1},{2+lb,1,2}],
Darker[Blue], Cuboid[{0,0,2+db}],
Black, Cuboid[{1,1,3},{2,2,3}]}],
{{r,0,"Red"},0,-1},{{o,0,"Orange"},0,1},{{dg,0,"Dark Green"},0,-1},{{b,-1,"Blue"},-1,0},{{lb,0,"Light Blue"},0,1},{{bw,0,"Brown"},0,1},{{y,0,"Yellow"},0,1},{{p,0,"Pink"},0,1},{{db,0,"Dark Blue"},0,-1},{{x,0,"Black"},-1,1}]

Section 3. Conclusion and Future Work

3.1 Summary

After trying different methods of getting the black cube to touch the black square on one side I came up with the easiest way. Using the certain order of {Orange, Brown, Light Blue, Dark Blue, Red, Black} will be the best solution to the puzzle.

3.2 Discussion

The most time consuming part of the project would have to have been the movement of each block in order to make a difficult but not impossible puzzle. After many trail and errors I developed a working puzzle.

3.3 Future Work

If I had more time to work on this project I would have added more aspects. For example I would add more cubes to manipulate. I would also have added more positions to Manipule like having each cuboid move both across and up and down.

Section 4. References

One reference I used is the Unblock game itself, here is a website with an example of the game 

 http://www.quickflashgames.com/games/unblock/