Today, Bill Gates is one of the richest men in the world. As co-founder of Microsoft, Gates built a tech empire. And as co-founder of the Bill & Melinda Gates Foundation, he’s given away billions of dollars. But who was Bill Gates before Microsoft? It turns out young Bill Gates was a rule breaker—and that might explain why he became one of the most successful self-taught programmers in history.

When he was just 11 years old, Bill Gates became argumentative and withdrawn. His parents, William and Mary Gates, worried that their son seemed bored in school. He also refused to do his chores and fought with his mother. Gates told a counselor, “I’m at war with my parents over who is in control.”

That drive for control and a willingness to bend the rules, channeled in the right direction, transformed Bill Gates from a sullen tween into a self-taught teen programmer. It all started when Gates’s parents enrolled him at Lakeside School in Seattle.

The preparatory school was one of the first in the country to own a computer. As Bill Gates explained, “I was 13 years old when I fell in love with programming. My school had just become one of the first in the country to get a computer terminal. The machine was huge and slow, and it didn’t even have a screen—but I was hooked.”

In 1968, Gates and his friends spent hours playing with the computer and learning its programming language: BASIC, or Beginner’s All-purpose Symbolic Instruction Code. Soon, Gates was creating his own programs.

Gates’s first attempt at programming involved a popular game. “I wrote my first software program when I was thirteen years old,” Gates related. “It was for playing tic-tac-toe. The computer I used was huge and cumbersome and slow and absolutely compelling.”

Computers looked much different when Bill Gates taught himself programming in the 1960s. “The computer terminal didn’t have a screen,” Gates recalled. “To play, we typed in our moves on a typewriter-style keyboard.” After entering each move in the tic-tac-toe game, the players had to wait for the computer to print out their move.

Gates didn’t create the program out of a desire for efficiency. “A game of tic-tac-toe that would take thirty seconds with a pencil and paper might eat up most of a lunch period. But who cared? There was just something neat about the machine.”

At Lakeside, Bill Gates met Paul Allen, a student who was two years older, in the computer room. The pair quickly learned how to log into the computer as the system operator to get around the time limit on the machine. And when the pair temporarily lost access to the Lakeside computer, they simply visited the University of Washington and pretended to be students.

Bill Gates was barely a teenager when he pretended to be a college student to access high powered computers. Along with Allen, Gates used a CDC 6400 and a Burroughs 5500, machines that required submitting punch cards that contained the code to run programs.

Gates translated his programming skills into business ventures while he was still in high school. He used Fortran, another programming language, to create Traf-O-Data. Paul Allen explained, “If it hadn’t been for our Traf-O-Data venture … you could definitely argue that Microsoft might not have happened.”

Traf-O-Data analyzed traffic volumes in Seattle. Allen and Gates were still teenagers when they made $20,000 with Traf-O-Data. While the company eventually went under, it taught Gates valuable lessons—such as the value of combining programming and business.

During his years at Lakeside, Gates spent time sneaking into different buildings on the UW campus to access computers. He and Allen heard a rumor that a PDP-10 in the Physics Building was available for a few hours a day in the early morning. “A friend had a key to the Physics Building so we went up there a lot of times,” Gates later admitted.

By the time he went off to Harvard—and dropped out after less than two years—Gates already had a wealth of programming experience. He’d founded a company, he’d created code for government agencies, and he’d taught himself numerous programming languages. As Gates later said, “Self-exploration is great, because you develop a sense of self-confidence.”

Programming gave Gates direction. “If your program is wrong, you know you try it and if it doesn’t work and then you fix it and try it again.”

Even from an early age, Gates saw computers in terms of rules. He was drawn to computing, Gates explained as an adult because it gave him a sense of control as a child. “We were too young to drive or do any of the other things adults could have fun at, but we could give this big machine orders and it would always obey.”

Bill Gates knew when to bend the rules and when to follow them. From a young age, he prioritized self-exploration. That willingness to push the enveloped later helped Microsoft succeed.

What can we learn from Bill Gates before Microsoft?

1. Learn when to bend the rules. Bill Gates might have snuck into college computer labs, but he did it for a good reason. Gates didn’t have access to the kinds of advanced computers at the UW. But Gates made connections to get what he wanted. As he explained, “The people there helped us learn a lot by loaning us manuals and by looking the other way when we took OS listings out of the garbage.”

2. Stay driven and keep exploring. Bill Gates didn’t give up when his first attempt at a company, Traf-o-data, fell apart. He didn’t give up after his arrest for a traffic violation in 1977. He kept working toward his goal of making computers accessible to millions—and he succeeded. Who was Bill Gates before Microsoft? A self-taught programmer who used his skills to achieve his goals.

How have you prioritized self-exploration? Let us know in the comments below!

Want to learn to program? Register for my free Self-Taught Coder Masterclass where I cover how I went from a novice to a software engineer at eBay in less than one year.