Every video game consists of thousands upon thousands of lines of code, written by programmers who have a firm grasp of coding and computer science. Some people may want to build a game of their own but find learning a new skill and all those lines of text and symbols to be intimidating.

While not everyone will become a computer scientist overnight, several games teach players the fundamentals of coding, sometimes without the user even realizing it. They require players to plan out a sequence of operations, define variables, and use logical reasoning in order to achieve tasks.

RELATED: Most Influential Sci-Fi Games

This kind of reasoning not only provides a foundation for coding but also for life. For instance, people might be required to execute this kind of thinking when planning out the best way to do a project, including what steps to take first, when to do them, what conditions need to be met to do them, and any other variables that might need to be factored in. Here are some games that teach computer science.

8 Portal 2 Makes Players Die Repeatedly For (Computer Science)!

First-person perspective of Chell, holding a Portal Gun, on a light bridge extending into a portal. To the left, a button panel and a metal doorway. Image credit: eurogamer.net

A list of games that teach coding logic has to have this classic science fiction game that has players jumping through portals and dying multiple times for science. In Portal 2, players are once again in the remains of Aperture Laboratories, where the sadistic and sarcastic AI, GladOS, is subjecting them to torturous puzzles.

Players of Portal 2 will have to bend their noodles if they want to survive GladOS’s torturous machinations. Rooms are populated with platforms, light bridges, pressure panels, and tractor beams. The inclusion of physics-altering gels adds further complexity to the gameplay. Through trial and error, players must navigate these contraptions, thinking through which portals to place where, and how to utilize those portals with the elements of each room. One wrong move and players could end up becoming a Chell Sandwich. The game even comes with a level editor that allows aspiring game developers to create their own challenges.

7 Glitchspace Requires “Programming” Blocks To Navigate Rooms

A transparent line graph on top of a white room with a red platform. Image credit: store.steampowered.com

Developer Space Budgie’s Glitchspace is another puzzle room-themed adventure. Taking place in a Tron-styled world, players must navigate shiny, neon-lit rooms and manipulate red blocks in order to make it to the exit without falling or getting derezzed by a data stream.

In order to achieve this, players will have to program the blocks’ behavior with a node-based interface. This includes anything from moving the blocks up and down as elevators, to rotating them and stretching them to create bridges. Things are simple at first, but players will soon be scratching their heads trying to figure out what they want each block to do, and how to manipulate each box to achieve the desired task. Simple functions can be stacked upon each other to create more intricacy in programming options.

6 Little Big Planet 2 Makes Players The Game Maker

A furry creature and a pink-eyed automaton on a platform. Image credit: blog.connectedcamps.com

The follow-up to Media Molecule’s smash hit Little Big Planet on PlayStation 3 is a classic platformer that brings the return of the adorable Sackboy, once again navigating worlds of handmade crafts and everyday items.

Little Big Planet already had a robust level editor, but Little Big Planet 2 brought things a step further by allowing players to create their own games with the assets provided to them. This included applying different behaviors to different objects, applying input to objects, and mapping out those behaviors to different buttons, allowing for a large variety of game-making possibilities.

5 While True: Learn () Is Machine Learning For Novices

A flow chart consisting of several nodes against a gray background. Image credit: indiedb.com

While True: Learn () from Luden.io is a quirky little game in which a programmer discovers that his cat has debugged his code, since, as everyone knows, cats are evil aliens bent on world domination. Now he is attempting to build a machine learning program to learn what his cat is saying.

RELATED: Epic Games Store Free Game while True: learn () Explained

The game uses a node-based interface to sort various pieces of data. Through the adventure, players will learn more about machine learning, and the different mechanisms used in programming artificial intelligence. Gameplay covers basic concepts such as if/else loops, and goes into deeper concepts such as decision trees and shape recognition. Accompanying the levels are articles and videos showing off real-world examples of programming and machine learning.

4 Gladiabots Lets Players Control Robots With Their Brains, Sort Of

Overhead shot of several robots locked in combat. Image credit: whatsonsteam.com

Who doesn’t love fighting robots that blow up? That is the premise of Gladiabots - AI Combat Arena, in which players pit their teams of robots against another team in a variety of tasks, including base capturing, capture the flag-type point-scoring, and all-around destruction.

Players do not assume direct control over these robots. Instead, they will have to program their behavior by means of nodes, which cover robots' actions and conditions under which to act, ranging from enemy range to shield levels. Different classes of robots with different strengths and weaknesses will push players’ critical thinking even further, forcing them to decide what the best programs will be for the best robots.

3 In The Talos Principle, A Robot Learns About Being Human

A white, humanoid robot, in front of a bridge on an Egyptian oasis. Image credit: eurogamer.net

The Talos Principle, developed by Croteam and published by both Croteam and Devolver Digital, is all about what it means to be human. Players assume the identity of a robot in ancient ruins, led along by the mysterious voice of one who calls himself Elohim. The set-up is essentially a parallel to the Genesis story of the Garden of Eden, granting players the freedom to explore anywhere in the available environments, but being forbidden from venturing to a specific tower, for, as Elohim warns players, “you will surely die.”

RELATED:Forgotten Puzzle Games You Need To Play

In order to progress through the game's rich narrative, players must acquire sigils that will unlock gates. To do this, they have to navigate mazes filled with sentinel bots, turrets, and force fields that can be dealt with using available signal jammers, blocks, and lasers. Players must calculate a number of variables in this game, like when to use a signal jammer to disable a bot versus when to sneak past and hope for the best. Solving these puzzles is satisfying when one puts the pieces together.

2 Human Resources Machine Treats Workers Like Robots

A top-down view of an office space. One human is sitting at at desk on the upper right corner, and another is next to the conveyor belt to the right.A green grid is on the floor. On the right of the image is a series of instructions. Image credit: store.steampowered.com

Human Resources Machine is another quirky title from the developer and publisher The Tomorrow Corporation. Players are assigned the task of managing office workers as they go about their assigned tasks of filing documents for the company.

Management of these tasks is done through a tile-based interface, which tells the workers what files to put in what spaces. This interface introduces such computer science concepts as input, output, and loops, to ensure that employees do their tasks efficiently. The Tomorrow Corporation even developed a separate version of this game for the annual Hour of Code during Computer Science Education Week.

1 Thanks To Redstone, Anyone In Minecraft Can Be A Computer Genius

Overhead of a Minecraft Redstone Circuit. Image credit: gaming.stackexchange.com

Minecraft pops up in list articles a lot, and for good reason – it is not only a fun game full of things to explore, but Minecraft is also a versatile creation tool, allowing players to make anything their hearts desire. Thanks to Redstone, players can also make computers in-world.

In the world of Minecraft, Redstone is the element that is a source of electricity, utilized in conjunction with a number of levers, pistons, and lights. Redstone also allows for the creation of logic gates, which are how information gets processed through computers. This allows players to create a number of creative contraptions, from binary calculators to basic computers built within the game itself.

MORE: Best Sci-Fi Games On Switch