Skip to content

Commit

Permalink
Merge pull request #20 from YujiSODE/Y20170521
Browse files Browse the repository at this point in the history
Y20170521
  • Loading branch information
YujiSODE authored May 21, 2017
2 parents eced948 + 88257bd commit 589697f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ https://github.com/YujiSODE/txtCell
______

### Scripts
1. `txtCell.js`: the interface for text based Cellular Automaton.
2. `imgMap.js`: the interface to convert "map data" into canvas "image" or canvas "image" into "map data".
3. `txtCell_lifeGame.js` and `txtCell_growingLifeGame.js`: Web Worker interfaces for Cellular Automaton.
1. [`txtCell.js`](#1txtcelljs): the interface for text based Cellular Automaton.
2. [`imgMap.js`](#2imgmapjs): the interface to convert "map data" into canvas "image" or canvas "image" into "map data".
3. [`txtCell_lifeGame.js` and `txtCell_growingLifeGame.js`](#3txtcell_lifegamejs-and-txtcell_growinglifegamejs): Web Worker interfaces for Cellular Automaton.
### Map data format
Map data:`'xxx...x@xxx...x@...'`;`x` is integer between 0 to 9.

### 1.`txtCell.js`
The interface for text based Cellular Automaton.
#### Function
`function txtCell(wkScrpt[,dataName][,map1][,map2])`
Parameters
Parameters
- `wkScrpt`: a filename of a script for Web Worker.
- [optional] `dataName`: name of a data set. timestamp is default value.
- [optional] `map1` and `map2`: map data. random map with 0 or 1 (n x n data) is default value.
Expand All @@ -40,7 +40,29 @@ Method of returned function
### 2.`imgMap.js`
The interface to convert "map data" into canvas "image" or canvas "image" into "map data".
#### Function
`function imgMap(canvasId)`
`function imgMap(canvasId)`
Parameters
- canvasId: id of canvas tag; canvas tag is generated when there is not target tag.

Returned function
- `function()`: function that returns Log Object.
Log object has following values:
- `canvasId`: id of target canvas tag.
\-----------------------------------
- `inputMap`: input data map for method `map2Cvs(map)`.
- `mapImage`: data URI for input data map with method `map2Cvs(map)`.
\-----------------------------------
- `outputMap`: output data map with method `cvs2Map(abcd)`.
- `abcd`: parameters to convert image into mapdata with method `cvs2Map(abcd)`.
v=f(RGBa-value)=a*R+b*G+c*B+d*a.

Method of returned function
- `function reset()`: method to reset Log Object.
- `function map2Cvs(map)`: method to convert map data into canvas image; map is map data.
"color chart" between blue(0) and red(9) is default output.
- `function cvs2Map(abcd)`: method to convert canvas image into map data.
`abcd` is a text expressing values a, b, c, and d that satisfies v=f(RGBa-value)=a*R+b*G+c*B+d*a;
e.g., "1011" means v=1*R+0*G+1*B+1*a. "1110" is default value.

### 3.`txtCell_lifeGame.js` and `txtCell_growingLifeGame.js`
Web Worker interfaces for Cellular Automaton.
Expand Down
2 changes: 1 addition & 1 deletion imgMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* - abcd: parameters to convert image into mapdata with method cvs2Map(abcd).
* v=f(RGBa-value)=a*R+b*G+c*B+d*a.
*=== Method of returned function ===
* - function reset(): method to reset Log Object
* - function reset(): method to reset Log Object.
* - function map2Cvs(map): method to convert map data into canvas image; map is map data.
* "color chart" between blue(0) and red(9) is default output.
* - function cvs2Map(abcd): method to convert canvas image into map data.
Expand Down

0 comments on commit 589697f

Please sign in to comment.