Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- // Type Defines +
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- #define Void 0
- #define Empty 1
- #define Res 2
- #define TYPE_COUNT 3
- //==============================================================================
- // |
- // = element Res |
- // |
- //==============================================================================
- //------------------------------------------------------------------------------
- // == Rules |
- //------------------------------------------------------------------------------
- /* Rule 1:
- ................................................................................
- _@ -> @_
- ................................................................................
- */
- bool Res_rs1_r1_given_keycode64(int _cursn) { /* @ */
- return true;
- }
- bool Res_rs1_r1_given_keycode95(int _cursn) { /* _ */
- return is(ew(_cursn), Empty);
- }
- void Res_rs1_r1_vote_keycode64(int _cursn, inout int _nvotes, inout int _winsn) { /* @ */
- int myvotes = 1;
- _nvotes += myvotes;
- if (random_create(int(_nvotes)) < myvotes) { _winsn = _cursn; }
- }
- void Res_rs1_r1_vote_keycode95(int _cursn, inout int _nvotes, inout int _winsn) { /* _ */
- int myvotes = 1;
- _nvotes += myvotes;
- if (random_create(int(_nvotes)) < myvotes) { _winsn = _cursn; }
- }
- bool Res_rs1_r1_check_keycode64(int _nvotes) { /* @ */
- return _nvotes > 0;
- }
- bool Res_rs1_r1_check_keycode95(int _nvotes) { /* _ */
- return _nvotes > 0;
- }
- void Res_rs1_r1_change_keycode64(int _cursn, int _winsn) { /* @ */
- ew(_cursn, ew(0));
- }
- void Res_rs1_r1_change_keycode95(int _cursn, int _winsn) { /* _ */
- ew(_cursn, new(Empty));
- }
- bool Res_rs1_r1_given() {
- if (!Res_rs1_r1_given_keycode64(0)) return false;
- if (!Res_rs1_r1_given_keycode95(1)) return false;
- return true;
- }
- void Res_rs1_r1_vote(inout int _nvotes_0, inout int _winsn_0, inout int _nvotes_1, inout int _winsn_1) {
- _nvotes_0 = 0; /* @ */
- _winsn_0 = 63;
- _nvotes_1 = 0; /* _ */
- _winsn_1 = 63;
- Res_rs1_r1_vote_keycode64(0, _nvotes_0, _winsn_0); /* @ */
- Res_rs1_r1_vote_keycode95(1, _nvotes_1, _winsn_1); /* _ */
- }
- bool Res_rs1_r1_check(int _nvotes_0, int _nvotes_1) {
- if (!Res_rs1_r1_check_keycode64(_nvotes_0)) return false; /* @ */
- if (!Res_rs1_r1_check_keycode95(_nvotes_1)) return false; /* _ */
- return true;
- }
- void Res_rs1_r1_change(int _winsn_0, int _winsn_1) {
- Res_rs1_r1_change_keycode95(0, _winsn_0); /* @ -> _ */
- Res_rs1_r1_change_keycode64(1, _winsn_1); /* _ -> @ */
- }
- bool Res_rs1_r1() {
- if (Res_rs1_r1_given()) {
- int _nvotes_0; /* @ */
- int _winsn_0;
- int _nvotes_1; /* _ */
- int _winsn_1;
- Res_rs1_r1_vote(_nvotes_0, _winsn_0, _nvotes_1, _winsn_1);
- if (Res_rs1_r1_check(_nvotes_0, _nvotes_1)) {
- Res_rs1_r1_change(_winsn_0, _winsn_1);
- return true;
- }
- }
- return false;
- }
- /* Rule 2:
- ................................................................................
- @ -> @
- ................................................................................
- */
- bool Res_rs1_r2_given_keycode64(int _cursn) { /* @ */
- return true;
- }
- void Res_rs1_r2_vote_keycode64(int _cursn, inout int _nvotes, inout int _winsn) { /* @ */
- int myvotes = 1;
- _nvotes += myvotes;
- if (random_create(int(_nvotes)) < myvotes) { _winsn = _cursn; }
- }
- bool Res_rs1_r2_check_keycode64(int _nvotes) { /* @ */
- return _nvotes > 0;
- }
- void Res_rs1_r2_change_keycode64(int _cursn, int _winsn) { /* @ */
- ew(_cursn, ew(0));
- }
- bool Res_rs1_r2_given() {
- if (!Res_rs1_r2_given_keycode64(0)) return false;
- return true;
- }
- void Res_rs1_r2_vote(inout int _nvotes_0, inout int _winsn_0) {
- _nvotes_0 = 0; /* @ */
- _winsn_0 = 63;
- Res_rs1_r2_vote_keycode64(0, _nvotes_0, _winsn_0); /* @ */
- }
- bool Res_rs1_r2_check(int _nvotes_0) {
- if (!Res_rs1_r2_check_keycode64(_nvotes_0)) return false; /* @ */
- return true;
- }
- void Res_rs1_r2_change(int _winsn_0) {
- Res_rs1_r2_change_keycode64(0, _winsn_0); /* @ -> @ */
- }
- bool Res_rs1_r2() {
- if (Res_rs1_r2_given()) {
- int _nvotes_0; /* @ */
- int _winsn_0;
- Res_rs1_r2_vote(_nvotes_0, _winsn_0);
- if (Res_rs1_r2_check(_nvotes_0)) {
- Res_rs1_r2_change(_winsn_0);
- return true;
- }
- }
- return false;
- }
- bool Res_rs1() {
- if (Res_rs1_r1()) return true;
- if (Res_rs1_r2()) return true;
- return false;
- }
- void Res_behave() {
- if (Res_rs1()) return;
- }
- ARGB Res_getColor(Unsigned selector) {
- return cu_color(0,255,0);
- }
- void Res_EVENT_START() {
- _SYMMETRY = random_create(8);
- }
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- // Dispatches +
- //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- void _BEHAVE_DISPATCH(uint type) {
- switch(type) {
- case Res: Res_EVENT_START(); Res_behave(); break;
- default: break;
- }
- }
- ARGB _COLOR_DISPATCH(uint type) {
- switch(type) {
- case Void: return uvec4(255,255,0,255);
- case Empty: return uvec4(255,0,0,0);
- case Res: return Res_getColor(0);
- default: return uvec4(255,0,255,255);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement