evolve4src/src/evolve_simulator/kforth_mutate.cpp
KFORTH_PROGRAM *kforth_merge(KFORTH_PROGRAM *kfp1, KFORTH_PROGRAM *kfp2)
{
	ASSERT( kfp1 != NULL );
	ASSERT( kfp2 != NULL );
	ASSERT( kfp1->kfops == kfp2->kfops );

	return kforth_merge_with_mask(0xAAAA, kfp1, kfp2);
}
/***********************************************************************
 * Deterministic merge operation:
 *
 * (This was the OLD way of merging. A better way is to use
 * the random bit string)
 *
 * Merge using alternating code blocks. The mask used
 * is: 1010 1010 1010 1010
 *
 *	PROGRAM 1	PROGRAM 2	RESULT
 *	---------	---------	----------
 *	ABBA		BLAG		ABBA
 *	JUNK		CRAP		CRAP
 *	FOOBAR		GREPLINUX	FOOBAR
 *	STUFF		XXYYZZ		XXYYZZ
 *	SUPERDUPER	FOOFOOFOO	SUPERDUPER
 *	FOO12h		FOO666		FOO666
 *			HHIIGG		HHIIGG
 *			HHUUPP		HHUUPP
 *			JJJJJJ		JJJJJJ
 *
 * Create a new program from 'kfp1' and 'kfp2'. 
 * Even numbered code blocks are donated by PROGRAM 1.
 * Odd numbered code blocks are donated by PROGRAM 2.
 *
 * If programs have different number of code blocks, then
 * extra code blocks from the longer program are appended
 * to the new program.
 *
 * NOTE: kforth_merge(x, x) is allowed, and will return a copy of 'x'
 *
 */
Deterministic merge operation:
(This was the OLD way of merging. A better way is to use
the random bit string)

Merge using alternating code blocks.



Create a new program from 'kfp1' and 'kfp2'.
Even numbered code blocks are donated by PROGRAM 1.
Odd numbered code blocks are donated by PROGRAM 2.

If programs have different number of code blocks, then
extra code blocks from the longer program are appended
to the new program.

kforth_merge(x, x) is allowed, and will return a copy of 'x'
Deterministic merge operation : ( This was the OLD way of merging . A better way is to use the random bit string ) Merge using alternating code blocks . Create a new program from ' kfp1 ' and ' kfp2 ' . Even numbered code blocks are donated by PROGRAM 1 . Odd numbered code blocks are donated by PROGRAM 2 . If programs have different number of code blocks then extra code blocks from the longer program are appended to the new program . kforth_merge ( x x ) is allowed and will return a copy of ' x '
KFORTH_PROGRAM *kforth_merge(KFORTH_PROGRAM *kfp1, KFORTH_PROGRAM *kfp2)
{
	ASSERT( kfp1 != NULL );
	ASSERT( kfp2 != NULL );
	ASSERT( kfp1->kfops == kfp2->kfops );
	return kforth_merge_with_mask(0xAAAA, kfp1, kfp2);
}
KFORTH_PROGRAM * kforth_merge ( KFORTH_PROGRAM * kfp1 , KFORTH_PROGRAM * kfp2 ) { ASSERT ( kfp1 != NULL ) ; ASSERT ( kfp2 != NULL ) ; ASSERT ( kfp1 -> kfops == kfp2 -> kfops ) ; return kforth_merge_with_mask ( 0xAAAA , kfp1 , kfp2 ) ; }
Deterministic merge operation:
 (This was the OLD way of merging.
Deterministic merge operation : ( This was the OLD way of merging .