The World Chess Federation (WCF) routinely performs drug tests. That’s not because it seems likely that chess players are enhancing their play with drugs, but to help the sport’s bid to be a part of the 2020 Olympics. The International Olympic Committee mandates that each sport has such a program in place.

But Olympics or not, the WCF’s drug tests are probably a good idea. A randomized-controlled trial has shown that two commonly prescribed prescription drugs—modafinil and ritalin—can be used to enhance performance in chess games. Modafinil is a wakefulness-promiting agent used to treat sleep disorders, while ritalin is often used to treat ADHD and narcolepsy. Both drugs are commonly used off-label as so-called “smart drugs” to improve cognitive function.

A group of researchers in Germany and Sweden recruited 39 competitive male chess players, who had an average IQ of 127 and an average chess Elo rating of about 1700 (an above-average rating in the system used to determine serious players’ skill level). They divided the group to test their performance after consuming either 200 mg of modafinil, 20 mg of ritalin, 200 mg of caffeine, or a placebo. Each participant then played 20 games against the computer which adjusted to their skill level. In each game, the participant had 15 minutes to make their moves.

Past studies on cognitive enhancers (or smart drugs) had shown that they tend to help people with lower scores to reach a fair-playing field, rather than those with higher scores. Among the many drugs tested, only modafinil had previously been shown to boost the performance of high scorers. So the researchers went into the study expecting to not see much of an effect.

The researchers were surprised to find that the players on smart drugs were actually losing more games than the players on the placebo. When they dug into the results a little more, they found that players taking cognitive enhancers were spending more time per move and thus losing the game because they were running out of time.

When they controlled for the extra time, however, they found that modafinil boosted performance by 15%, ritalin by 13%, and caffeine by 9%. The placebo, as expected, didn’t do anything. The researchers believe that cognitive enhancers were helping players perform more mental calculations and make better moves.

“These substances may be able to convert fast and shallow thinkers into deeper but somewhat slower thinkers,” the researchers wrote in the study.

The effects of modafinil and ritalin were significant. The drugs could enhance the player’s ranking by 35 Elo points, which would move the average player in the study from a world ranking of 5,000 to 3,500. Put another way, a smart drug could enhance the chance of winning a chess game by 5%, which in the world of competitive chess is a huge advantage. The catch is that such smart drugs could actually be detrimental in rapid chess games, a high-speed version of the game which typically gives a player less than 60 minutes to make their moves.

The study will need to be replicated to be sure that the results stand up. If it does, the WCF will be proved right for performing drug tests. Both ritalin and modafinil are already on the World Anti-Doping Agency’s list, and caffeine is on the restricted list (which means players must keep their intake low).