Matthew Ridley, 24, has won this year's Python coding prize competition at Man AHL. He's now £5k ($6.3k) richer and has attracted the attention of one of the UK's top quantitative hedge funds - which isn't bad considering he hasn't even left university yet.
Ridley's part way through a PhD in astrophysics at Oxford University. "My PhD is on the Milky Way galaxy and I do simulations of gas and how it moves around," he says. Coding is integral to his thesis, but he's only been coding in Python for two years: "I run simulations using C++ because its quite a fast programming language so it’s useful, but it’s also much harder to write and less user-friendly than Python! So, I use Python for the more straightforward things, such as analysing simulations and ongoing analysis."
This is the second year that AHL's run its coder prize, which is open to students aged between 16 and 25. Participants are asked to write code that will control a player in 'HiveMinder', a proprietary game (involving a bee) written by Man for the purposes of the competition. You can see last year's winning code here.
Ridley didn't disclose his winning code, but he did offer some pointers on how he came to write it. Firstly, he codes a lot: "I spend approximately six to eight hours a day working on my PhD and around 90% of that time is spent coding." Secondly, he has a pragmatic, scientific, approach to coding and doesn't adhere to the processes followed by some computer science students: "When you’re learning to code in science, you tend to jump straight into the deep end, using coding to achieve what you need to get done...". Thirdly, he kept it simple: "I joined the competition relatively late in the process and I think that meant that my code was more general...this allowed my approach to be quite flexible, which meant that I could modify quickly and add new things."
While other entrants tried to code complex strategies based upon AHL's rules for HiveMinder, Ridley says he approached the problem more straightforwardly. "I tried to look at the possible moves five moves in advance and to analyse the different possible states of the game." To do this, he had to program his own scoring system: "That allowed me to look forward and assess each of the states of the game and decide on the best action to take for each move."
Ridley's aptitude for Python after two years might inspire other students to take coding courses, but he says these aren't the best way to learn a coding language. - The best option is peer review. "Read other people’s code and learn from the way they approach things," he advises, saying he learnt a lot from a "really good coder" at an Oxford start-up he worked for: "You get to see new things and what good code looks like."
Despite winning Man AHL's prize, Ridley isn't about to run for a job at a hedge fund. He still has two years of his PhD to go and is keeping all options open: "I could stay in academia or venture out into finance, tech or something completely different." Even through he's an astrophysicist, Man may well want to hire Ridley in future. "Many of my most successful people have come from a non-finance background. It’s much easier to teach market knowledge than it is to teach people a passion for coding," said Man's co-chief technology officer in November.