svn co https://svn.sourceforge.net/svnroot/scig/trunk scigTo do this you must have SVN installed.
Place the scig directory in a place you can access via web server and point your browser to file sample.php in doc directory. If all images are displayed correctly then you have successfully installed SCIG. If you don't see one or more of the images make sure you have PHP and PHPGD installed. Also, if you got the source from SVN, you may need to set use cache option in configuration.yml file to false. Contact me if you encounter other problems.
In most cases you will have to know only first three sections of this chapter. Rest will be needed only when you will want to create something more complicated or totally new. Also go through existing SCIG files if you have problems understanding any of the SCIG features.
Everytime you run scig.php you can specify two parameters: desc and data. The first one is the name of the description file without the yml extension. Description files are placed in directory descriptions. They contain information about general structure of an image that will be generated. Read more about them here. The data can be one of two things: a state of the puzzle or an algorithm.
Let's say you want to create nice image for your pr0 T permutation. Then your data will be your algorithm: RUR'U'R'FR2U'R'U'RUR'F'. You would like to see top face with arrows and front view of the cube. Luckily there already exists a description file (sample/pll) which describes such situation, let's use it.
You can configure general SCIG behaviour in file configuration.yml. YAML is used here (like almost everywhere in SCIG). Don't worry, you don't have to fully learn new language. YAML is extremaly simple and readable so actually no explanation is needed.
width: 100 height: 100 mode: normal puzzle: Rubiks Cube parts: - main: x: 0 y: 0 width: 100 height: 100 view: 3face scheme: BOYAnd the URL:
scig.php?desc=sample/simple&data=1.0.2.3.4.5.6.7.8.9.10.11.0.1.2.3.4.5.6.7.0.1.2.3.4.5The result would be:
parts: - normal: x: 0 y: 0 width: 100 height: 100 view: 3face scheme: BOY - top: x: 200 y: 0 width: 100 height: 100 view: top scheme: BOY - blackandwhite: x: 300 y: 0 width: 100 height: 100 view: top scheme: blacktop
color name: red green bluewhere red, green and blue are numbers from range 0-255. Later (color schemes) you don't have to remember these numbers, you just use color names. It is important to have transparent color defined, so it can be used in views in some special cases.
all: dark gray U: yellow stickers: red: FU FRU FLU green: RU RUF RUB orange: BU BRU BLU blue: LU LUF LUBIf all appears in file it is always processed first and sets color of all stickers to the one given. In the example above first we set all stickers to dark gray. Then SCIG reads pairs facename: color and sets all stickers on that face to the given color. Next are pairs stickername: color which set one sticker to given color. Remember that if theres a sticker which has the same name as face (for example U is a sticker and a face on Rubiks Cube) SCIG will always consider it a face. You should use stickers to set colors of such stickers. stickers is always read at the end, you can set with it's help many stickers to one color. Of course you could define colors of all stickers with stickers, but it would take much more time and effort. Remember to color all stickers (with all) first to the most common color, then color faces and stickers as last.
There are also few special elements which can appear in color scheme:
- beginx beginy endx endy [color]Where beginx, beginy, endx, endy should be numbers >0 and <
- sticker coord1x coord1y [coord2x coord2y [coord3x coord3y...]]It means you always must specify sticker and two coordinates, but you can more. If you will give two coordinates SCIG will fill the image at the given coordinates with sticker's color. These coordinates will also be use to draw arrows. Four coordinates mean that you want to draw rectangle filled with sticker's color. Center of the rectangle will be used to draw arrows. If more coordinates are specified SCIG will consider them as filled polygon vertices. It will calculate it's center of mass to draw arrows.
arrows: UF UR UB ULwill draw arrows between edges of top layer. SCIG will not care about orientation of a piece.
arrows: UF UR UB UL UFR UFL UBR UBL
Smart arrows enabled | Smart arrows disabled |
stickers: - piecetype: - [stickerofpiece, stickerofpiece...] # stickers of one piece - [stickerofanotherpiece...] # stickers of another piece ... # next pieces - anotherpiecetype: ...Let's look at Rubiks Cube stickers:
stickers: - edges: - [UF, FU] - [UR, RU] - [UB, BU] - [UL, LU] - [DF, FD] - [DR, RD] - [DB, BD] - [DL, LD] - [FR, RF] - [FL, LF] - [BR, RB] - [BL, LB] - corners: - [UFR, FRU, RUF] - [UFL, FLU, LUF] - [UBR, BRU, RUB] - [UBL, BLU, LUB] - [DFR, FRD, RDF] - [DFL, FLD, LDF] - [DBR, BRD, RDB] - [DBL, BLD, LDB] - centers: - U - D - F - B - R - L
faces: - facename - sticker1 - sticker2 ... - anotherfacename ... ...
$state=$engine->process($alg,$state);Then for any stickername $state[stickername] should be also a sticker name and it means there's a $state[stickername] in stickername's place.
algorithms: - data: algorithm # where algorithm is for example RUR' [other options] - data: algorithm2 [other options] ...data is required and is an algorithm or state for which an image will be generated.[other options are pairs option: value which can be used in templates. For example if you also want to display a short description of an algorithm you can specify description: Very nice alg and then use {DESCRIPTION} in template.
<!-- BEGIN: main --> template content <!-- END: main -->Remember that you can use here variables defined in collection file (uppercase). SCIG will insert the image in the place of {IMAGE}. Example:
<!-- BEGIN: main --> <tr><td align="center"><letter>{NAME}</letter></td><td align="center"><img src="../{IMAGE}"></td> <td align="center"><alg>{ALG}</alg></td><td><comment>{DESCRIPTION}</comment></td></tr> <!-- END: main -->