The quality of a resource type Q r is drawn from a random distribution with mean 0.1 and standard deviation of 0.1 (Fig. 1 b light gray), and all items of a given resource type have the same quality. Thus we generate variation in quality across resource types which enables the learning process to be studied as an optimization process. Quality defines the maximal reward that a forager can obtain from a resource type when it has sufficient experience with processing that resource type. Task difficulty is defined by H r, the practice time (or experience) needed to obtain half of the maximal reward of that resource type, and S r, which defines how the reward increases with experience (see ‘Skill learning’ below). S r varies randomly between 1 and 4 (integer values only) and H r is varied across simulations to determine an overall difficulty of learning in the environment.