The paper discusses the application of Reinforcement Learning to the control of an onshore Wave Energy Converter (WEC). The proposed WEC features a simple and low-cost architecture. It is characterized by an oscillating floating rocker arm which moves a four bar linkage in the vertical plane. A mechanical rectifier, based on two one-way clutches and a multiplier gearbox, transforms the low speed oscillating motion of the four bar into a higher-speed unidirectional rotation of the electrical generator. The dynamic model of the WEC, based on multibody approach and Linear Wave Theory, is presented. Then a Reinforcement Learning (RL) algorithm, a Q-learning method, is applied to dynamically adjust the generator speed-torque ratio as a function of the sea state. Simulation results show the effectiveness of this model-free adaptive control in tuning the system in order to maximize the generated power. Starting from a simple monochromatic model of the sea, the presented approach is verified according to sea conditions of increasing complexity, and finally to long term time series, obtained from measurements of real sea states in the considered geographical region. The tuning of the hyper-parameters of RL algorithm with respect to the speed of convergence and optimality of generated power is also discussed.