David Lightman (Matthew Broderick) is an intelligent, underachieving teen who spends most of his free time playing arcade video games or messing around on his computer. During an automated modem search, he finds a strange computer that appears to be affiliated with a game company. A list of games appears, but Lightman doesn't have the password. After doing extensive research, he correctly guesses it. As would-be girlfriend Jennifer (Ally Sheedy) watches, he begins playing "Global Thermonuclear War" and targets his hometown (Seattle) and Las Vegas for Soviet strikes.
Unknown to the teens, the computer behind "Global Thermonuclear War" is not a game software company -- it is the War Operations Plan Response (W.O.P.R.) -- a top-secret military system that helps the Air Force decide what to do in the event of a Soviet attack. On their situation screens deep below Cheyenne Mountain, Colorado, the military actually thinks a first-strike is occurring. Top programmer Dr. McKittrick (Dabney Coleman) figures out what has happened, but it seemed all too real for a few minutes.
The government soon finds out who broke into their system, and Lightman is arrested and taken to Cheyenne Mountain for debriefing. It is assumed that he is affiliated with the Soviet KGB! He realizes that the W.O.P.R. is still "playing" Global Thermonuclear War, and needs to be stopped. The computer is feeding false data to the Americans, trying to get them to "move." General Beringer (Barry Corbin), a hawkish sort, is putting US forces on increasingly higher levels of Alert (known as Defense Conditions, or DefCon). When the computer convinces him that full-scale Russian attack is inbound, the General will order a counterattack.
Lightman cleverly escapes from Cheyenne Mountain, seeking Dr. Stephen Falken (John Wood), the original programmer of W.O.P.R. Dr. Falken grew increasingly concerned about the program, took an assumed name and retired to Oregon. Jennifer helps Lightman to find the Doctor, and they manage to convince the cynical programmer to stop World War Three.
At the last minute, while W.O.P.R. is busy feeding "game" data of inbound Soviet nuclear missiles to General Beringer's staff, Lightman and Falken arrive. They convince the General to wait and see if actual nuclear hits take place (which of course doesn't happen). The computer then tries to "guess" the encrypted launch code that will allow it to launch the US missiles and "win." Lightman and Falken try playing Tic-Tac-Toe against the super-computer, which ultimately teaches it the concept of futility. Just before launching the US missiles, W.O.P.R. quickly runs all the possible nuclear scenarios looking for a situation where it can truly triumph. It ultimately decides that Global Thermonuclear War is futile: there is no winner. Better to play a nice game of Chess.
In a remote part of a desert, two Air Force members, one an office, the other enlisted, arrive at a seemingly abandoned house. They go through a strict security check and walk into a nuclear missile command room, bidding the previously stationed men a good night. The two begin their shift with a few checks of the equipment. After a few moments of conversation they receive a "flash traffic" message ordering them to confirm launch codes for the missiles. The codes are confirmed at the men insert the keys that will launch the missiles. The commanding officer, Jerry, demands that his subordinate, Steve, try to get Strategic Command on the phone. Steve argues that calling someone isn't the correct procedure but Jerry insists. When Steve is unable to reach anyone, Jerry continues the procedure for launch. However, when the moment arrives to turn both keys to "Launch" Jerry takes his hand off the key. Steven threatens him with a pistol...
The scene suddenly cuts short and the opening titles of the film begin. Two United States government officials are arriving at NORAD (North American Aerospace Defense Command) in the Rocky Mountains of Colorado. The two men meet with the commanding general, Beringer, and the chief computer systems programmer, John McKittrick, about the two Air Force men who failed to launch their missiles. Unbeknownst to Jerry and Steve, their launch mode order was a simulation designed to test the psychological resolve of both men to launch their missiles when ordered to. After a brief discussion about the mental limits of committing such an order, with Beringer defending the tradition of having actual human beings in the command bunkers, McKittrick recommends that they "take the men out of the loop" and put computer software in the bunkers, with command of that software resting at NORAD. McKittrick also shows the officials the WOPR (War Operations Programmed Response) computer, a supercomputer system that takes all incoming data from the NORAD war room and analyzes it, creating endless scenarios of nuclear war. If McKittrick's idea is accepting and implemented by Washington, then WOPR would provide instructions as to how the United States will respond in a nuclear attack. The government men decide to pass McKittrick's idea on to authorities in DC and to the president.
In Seattle, Washington, in a video arcade, a high school student, David, is playing a game called Galaga when he looks at his watch and realizes he's late for school. He passes the game on to a younger friend of his and rushes to school, late for his biology class. After a few moments sitting and reviewing a test that he'd failed, David insults his belligerent teacher and is sent to the school's disciplinary officer. While he waits in the outer office, he slyly checks a hidden list of passwords.
After school, David is picked up by his biology classmate, Jennifer, who'd inadvertently helped him acquire the password. She takes him to his house and he shows her his room where he's set up an elaborate personal computer system. David is a computer hacker and he quickly logs in to the school's system using the password he'd stolen. He accesses his own grades and jovially changes his biology grade from an F to a passing grade. Jennifer is stunned by his actions and becomes agitated when David pulls up her grades. He changes her biology grade as well but she insists he change it back, which he does. After she leaves, he changes her grade to an A.
In the bunker that Jerry and Steve worked in, their personal command equipment is removed and replaced with a remote device that will do their jobs for them. Jerry looks crestfallen.
While dining with his indifferent parents, David finds an advertisement for a software company called Protovision, which plans to release new video games. David calls Information and gets the number for Protovision, as well as the the other prefixes for the area of Sunnyvale, California. He has his computer begin dialing all the numbers in the area, not only looking for the software company but other businesses that could be useful in his hacking. Later, at the video arcade, Jennifer finds David and asks if he could change her grade again. David suggests that the password might have been changed again but Jennifer insists. When they go back to David's room, David shows Jennifer that he's programmed his computer to dial every number in the Sunnyvale area, mining them for other businesses. He also tells Jennifer that he changed her biology grade already. When David checks the numbers he's mined, he finds one that will not allow him to log on. He asks it to "list games" & a list appears showing some standard games like Chess, Backgammon and Tic-Tac-Toe and "Falken's Maze". However, the last two games on the list are named "Theater-wide Biotoxic and Chemical Warfare" and "Global Thermonuclear War."
David takes the list to a computer technician who tells him that though David can't get in the system through normal channels so he should look for a "back door", a password left by the original programmer that may give him access. David begins to research the name "Falken" and discovers that it's the name of a computer programmer and artificial intelligence expert from the 1960s named Steven Falken. Falken himself had a son named Joshua who died in a car accident with his mother. Falken's health deteriorated and he himself died several years before. When Jennifer visits David again, David suddenly realizes that Falken's password is his son's name. He types in the password and is granted access to the system where he poses as Falken and asks the computer if they can play Global Thermonuclear War. David chooses the side of the Soviet Union and orders both Las Vegas and Seattle to be primary targets for nuclear strikes.
At NORAD, the attack suddenly appears on the screens of their command center. The simulated warheads have already gone over the North Pole, causing a brief panic. Beringer orders a change in DEFCON (DEFense CONdition) to a status level of three. Back at his room, David and Jennifer are delighted at the complexity of the "game" when David's father yells for David to clean up some garbage the family dog had spilled. David abruptly turns his computer system off and the simulation disappears from NORAD's screens. A technician rushes in yelling that the scenario isn't real. He goes on to explain that someone from the outside has hacked into the system and ordered a simulation. Though they can't pinpoint David's precise location, they determine he's in Seattle.
David returns home one night to see a news report about the alert he caused. David quickly becomes anxious and disappears to his room. Jennifer calls saying she'd seen the news report too. David panics, worrying that government officials will find him. Jennifer tells him not to call the phone number again. While he destroys all the printouts of his research on Falken, the phone rings; the WOPR computer, AKA, Joshua, has called him. David tries to tell it that he's not Falken and that Falken is dead. Joshua doesn't accept the truth and tells David that the game program is still running; in a matter of hours Joshua will be able to launch a full-scale nuclear attack. David hangs up the phone but receives another call with the same computer tone; he unplugs his phone.
Some time later David is leaving a 7-11 store when he's suddenly surrounded by FBI agents and forced into a waiting van. He's taken to NORAD and held in custody while McKittrick & Beringer meet with the FBI. They discuss how David was able to hack into the WOPR; somehow the phone lines in Sunnyvale had gotten crossed. They also assume David had either been working with another operative and was recruited by the Soviet government to be a spy. McKittrick requests that he be allowed to talk to David himself. David is temporarily released and shown around NORAD by McKittrick - David is slightly awed when he actually sees the WOPR, realizing that it's Joshua. In McKittrick's office, David is grilled for a bit - McKittrick wants to know how David could bypass his security. McKittrick receives a phone call and has to leave his office immediately. David uses McKittrick's office computer to talk to Joshua and finds out that Falken may still be alive, getting an address in Goose Island, Oregon. Moments later, he's seized by the guards, ranting to McKittrick about Joshua and Falken. He's returned to his "cell" a small, locked room in the facility's infirmary. David searches the drawers and finds some surgical instruments and a mini-tape recorder. He tricks the guard into opening the door and makes a recording of the code, opening the door himself. He rigs the door to lock permanently and escapes the infirmary through an air duct. David joins a tour group in the facility and escapes NORAD.
David hitches a ride with a truck driver who drops him off near Grand Junction, Colorado. He jimmies a pay phone and calls information, asking about Falken's address in Oregon. There is no phone listing for Falken, or his alias. David next calls Jennifer in Seattle, who tells him that his parents are freaked out at their son being arrested and that he should come home immediately. David tells her he can't & asks her for money to buy a plane ticket to Goose Island. When he lands, he's surprised by Jennifer, who drove down to meet him. The two catch the ferry over to the island; on board David explains that Joshua is still playing the "game" and plans to launch US missiles in a 1st strike attack against the Soviets. Jennifer says she believes him & the two of them kiss on the way to the island.
While walking around the island looking for Falken, they are nearly hit by a remote-controlled model pterodactyl. The artificial bird's owner is a friendly gentleman who turns out to be Falken himself, who tells them they're trespassing and begins to leave. When David mentions Joshua, Falken relents and invites them to his house. While showing them a film depicting extinct prehistoric creatures, he tells the teenagers that the threat of nuclear war is too great to stop and that humans are meant to become extinct, much like the dinosaurs, therefore he's not interested in stopping Joshua from completing it's mission. Falken also asks Jennifer if she ever played Tic-Tac-Toe. Jennifer says she did but doesn't anymore because it always ends in a tie. Falken reinforces his logic, saying the game is pointless.
David and Jennifer argue that life is worth living and that Falken would try to stop the coming holocaust if his son were still alive. Falken doesn't have an answer & tells the two that they've missed the last ferry to the mainland. He invites them to stay but they refuse. While walking around the island again, they look for a boat. Jennifer suggests they swim to the mainland but David tells her he never learned to swim. Saddened by his failure with Falken, David becomes depressed and Jennifer comforts him. Suddenly a helicopter appears and chases them for a few minutes before Falken reveals himself as the pilot. He has them board the helicopter and they take off.
At NORAD, a staff member in the war room is alerted to a missile launch from a Soviet submarine. Beringer orders the mountain facility to be sealed and orders DEFCON to be set at one.
David, Jennifer and Falken arrive at the mountain just before the thick pressure door is closed and sealed. In the war room, Falken meets McKittrick and tells him the situation is a bluff engineered by Joshua. He suggests to Beringer that the Soviet Union would never attack unprovoked with all the weapons shown on the screens. He also suggests that they "ride out" the attack and let the 1st strike happen. Beringer communicates with officers from three military bases that will be hit first. He tells them to ride out the attack. When impact finally occurs, the officers report that they are very much alive. The war room celebrates and Beringer happily orders his bomber planes and missiles back to "stand down" status.
Falken discovers a strange code running on one of the screens that shows 10 random numbers and letters cycling endlessly. He tells David and Jennifer that the digits are codes to launch the missiles and that Joshua is rapidly deciphering them. Falken and McKittrick try their own passwords but all access to the system is locked out. Jennifer scolds David for playing the game and David has a revelation: Joshua must be taught that certain games are unwinnable. He uses a terminal & commands Joshua to play Tic-Tac-Toe which gives him access to Joshua. David plays Joshua, resulting in a few tie games. He has Joshua play itself, resulting in hundreds of tie games until the screens change and show several hundred scenarios of 1st strikes by and on various nations, each with no winner listed. Suddenly the screens go blank and Joshua's electronic voice pops up, greeting Falken himself. Joshua says calls the game "strange" and says "the only winning move is not to play." Joshua has learned that there can be no winners in nuclear war. Joshua asks if anyone wants to play chess. McKittrick, Falken, David, and Jennifer join the celebration in the war room.