In this paper we introduce a new approach for Genetic Programming, called rule-based Genetic Programming, or RBGP in short. A program evolved in the RBGP syntax is a list of rules. Each rule consists of two conditions, combined with a logical operator, and an action part. Such rules are independent from each other in terms of position (mostly) and cardinality (always). This reduces the epistasis drastically and hence, the genetic reproduction operations are much more likely to produce good results than in other Genetic Programming methodologies. In order to verify the utility of our idea, we apply RBGP to a hard problem in distributed systems. With it, we are able to obtain emergent algorithms for mutual exclusion at a distributed critical section.