The solution consists of two programs: one for the producer and one for the consumers.
The consumer Karas
After stepping on a cloverleaf, Kara first searches the end of the block and then replaces the cloverleafs. Afterwards Kara leaves the block and releases the critical section. When leaving the cloverleaf block, Kara has to make sure the he does not collide with another Kara. Finally, having left the block, Kara restarts searching for another block of leafs.
The producer Kara
In the state "lay leaf", Kara tests if the field ahead and the fields to his left and right are empty. If so, he lays down a cloverleaf and takes a step forward (middle image). He continues laying down cloverleafs with a certain probability while the three fields next to him are empty. Otherwise, he changes to the state "walk" to look for a new position for a cloverleaf block.
Hint: To avoid that a consumer Kara starts replacing a block before the producer has finished laying it down, the state "lay leaf" is marked as a critical section.