1 / 8

# Cube

Cube. Assignment #2 Programming Language, Spring 2003. Cube. Cube 3 by 3 by 3 cube built of 27 smaller cubes Cube is fallen apart into 7 pieces 7 pieces can be assembled in many ways to again form the cube. Assembled Cube. Representation Linearized form string

## Cube

An Image/Link below is provided (as is) to download presentation Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

### Presentation Transcript

1. Cube Assignment #2 Programming Language, Spring 2003

2. Cube • Cube • 3 by 3 by 3 cube built of 27 smaller cubes • Cube is fallen apart into 7 pieces • 7 pieces can be assembled in many ways to again form the cube

3. Assembled Cube • Representation • Linearized form string • Substrings representing the front, middle and back plane • Substrings representing the top, middle and bottom row • Substrings representing the left, middle and right cell • Example • adcaccaacddgbfgffedggbfebee • aababbadcffegfcddcfeeggedgc

4. Assignment • Objectives • Computes all possibilities of assembling the cube • But suppress solutions that are mere rotations of another solution • Choose only one from the possibilities

5. Source Code • cube.java • Input file • Get input name by program argument • \$>java cube cube.in • Output • All possibilities of assembling the cube • Output file name • cube.out

6. Input • cube.in • Contains • Number of pieces of the cube • Lines with symbol and linearized form of each piece • Example • 7 • a{aaaa00000000000000000000000} • b{bb0b00000000000000000000000} • c{ccc0c0000000000000000000000} • d{dd00dd000000000000000000000} • e{ee0e00000e00000000000000000} • f{ff0f00000000f00000000000000} • g{gg0g000000g0000000000000000}

7. Output • cube.out • All possibilities of assembling the cube • Suppress solutions that are mere rotations of another • Choose only one from the possibilities • Output string is a linearized form of the cube • Example • aaaabbcdbeffcggcddeefegfcgd • aaaabbcdbeggcgfcddeegeffcfd • aaaabbcdbggecdfcdfgeegdecff • ...

8. Spec. • Assignment Spec. • System • Unix (junebug.snu.ac.kr) • Language • Java • Compile • Use Makefile • \$>make • Execution • \$>java cube cube.in • Test • \$>./test

More Related