DEV Community

Cover image for AI Journey — from chess to software development!
Damian Mazurek
Damian Mazurek

Posted on

AI Journey — from chess to software development!

I recently read a fascinating book about AI created by Garry Kasparov. In his book “Deep Thinking: Where Machine Intelligence Ends and Human Creativity Begins,” chess grandmaster reflects on his famous match against the Deep Blue computer in 1997 and the subsequent evolution of artificial intelligence.

Rule-based chess engines

The history of human versus artificial intelligence (AI) chess competitions stretches back decades, with each new match raising the stakes and pushing the boundaries of what was thought possible.
In the early days of AI, computers were programmed to follow a set of rules to play chess. These rule-based systems were limited by the instructions they were given and were no match for top human players.
Rules-based chess engines were computer programs that used a set of predefined rules to analyze and play chess. These rules were based on chess strategy and tactics. They evaluated the positions of the pieces on the board and made decisions about which moves to play.
One of the primary tasks of a rules-based chess engine was to search the game tree to find the best move for a given position. This approach involves considering all possible actions that could be made from the current situation and evaluating the resulting positions to determine which is the most advantageous. The engine used its predefined rules to choose how to value each position and select the move that leads to the best position.

AI will never win in chess against a human — this is too complex for a machine.

At this point, people did not believe that machines could beat human chess players. Chess had a long history and a rich tradition, and many people thought the game was too complex and subtle for a machine to master. Many people believed that chess required a level of creativity, strategic thinking, pattern recognition, and intuition that could only be found in humans and that computers would never be able to match the skills of the best human chess players. They were right. In the 80s, AI was not even close to chess’s top human performance level. But this was about to change in the next 20 years.

Deep Blue

As AI technology advanced, so too did its ability to play chess. In 1997, the Deep Blue computer developed by IBM faced off against chess grandmaster Garry Kasparov in a highly publicized six-game match.
Deep Blue was explicitly designed to play chess. It was programmed with a database of chess positions, moves, and algorithms for analyzing and choosing the best move in a given situation. It was able to analyze millions of positions per second and make decisions faster than any human player could.
Kasparov won the first game, but Deep Blue won the second, and the match ended in a draw. Deep Blue emerged as the champion in the final four games, winning three and drawing one. Overall, Deep Blue won the match with a score of 3.5–2.5.
The match between Kasparov and Deep Blue was a historic event that marked a significant milestone in the development of artificial intelligence and the potential for computers to outperform humans in specific tasks.

Modern-era chess engines

However, this was just the beginning of the AI chess revolution. In the years that followed, AI systems consistently improved and outperformed top human players. In 2005, an AI system called Hydra defeated world champion Vladimir Kramnik in a match.
In 2008 the first version of Stockfish was released. Since its inception, Stockfish has consistently ranked as one of the strongest chess engines in the world. It has won numerous titles and accolades, including the World Computer Chess Championship in 2014, 2015, 2016, and 2017 and the Top Chess Engine Championship in 2015, 2016, 2017, 2018, and 2019.
AlphaZero — reinforcement learning in chess.
As AI technology continued to advance, so did how it was used in chess. In 2017, an AI system called AlphaZero, developed by DeepMind, made headlines when it defeated the world’s best chess-playing computer program, Stockfish, in a 100-game match, winning 28 games and drawing 72.
AlphaZero was trained using a novel approach called reinforcement learning, in which it learned to play chess by playing against itself and receiving rewards for winning or drawing games.
This victory was significant because it demonstrated that the reinforcement learning approach could produce a chess-playing AI that could outperform traditional chess engines designed and tuned to play chess.
There was a crucial difference in how they played chess: Stockfish was known for its strong positional evaluation and ability to search deep into the game tree. In contrast, AlphaZero was known for its ability to come up with creative and unexpected moves.

From chess to other games

In 2019, DeepMind released MuZero, a variant of AlphaZero that was designed to be more general and flexible so that it can be applied to a broader range of tasks. Like AlphaZero, MuZero used reinforcement learning to learn how to play a game by playing against itself and receiving rewards for winning or drawing matches. However, unlike AlphaZero, MuZero did not require prior knowledge about the game it was learning to play, and it could learn to play a game from scratch based on raw pixel data.
MuZero was able to match AlphaZero’s performance in chess and shogi, and it even set a new world record by improving upon AlphaZero’s performance in Go. Additionally, MuZero surpassed state-of-the-art in mastering a suite of 57 Atari games known for their visually complex environments. These achievements demonstrate the flexibility and adaptability of MuZero, as it was able to learn and master a wide range of games with ease.

Why is Software Development new chess for AI?

The development of AI in chess is impressive. Over 30 years, we have come from engines based on sets of rules to mechanisms that can independently learn what the rules of the game are and how to play at a world-class level. Meanwhile, the new playground for AI was selected — software development.
Software development and chess can be viewed as complex problems that can be approached using artificial intelligence. Both involve making decisions based on incomplete information and adapting to changing circumstances. They require creativity, strategic thinking, pattern recognition, and adaptability. Both software development and chess also involve optimizing for specific goals or objectives. The objective of software development is to create efficient and reliable code that meets the user’s needs. In chess, the goal is to win the game by placing the opponent in a position where they cannot make a legal move. This makes software development an ideal ground to apply and develop AI systems.
An additional problem that AI can solve in this area is a problem with fewer skilled software engineers compared to demand. In this case, artificial intelligence can help with the following:

  • Automating repetitive tasks: AI can be used to automate tasks that are time-consuming and repetitive, such as testing and debugging code. This can free up developers to focus on more complex and creative tasks. Enhancing productivity: AI tools can help developers write code faster and more accurately by automatically providing suggestions and completing tasks.
  • Providing assistance: Some AI tools can help developers with tasks such as identifying and fixing bugs or suggesting alternative solutions.
  • Improving security: AI can detect and prevent security vulnerabilities in code, helping ensure software systems’ security and integrity.
  • Code review: AI can analyze code and suggest improvements, such as refactoring code more efficiently or adhering to coding standards. In the future, like in the chess example, AI can be more efficient in software development than humans. It could create high-quality code based only on user requirements and be able to define requirements for specific applications. Maybe in a couple of years, the user will only say: “Create me a social media platform,” and AI will:
  • Generate all use cases.
  • Propose ideas for innovative functionalities.
  • Create a user interface.
  • Create an architecture for the whole system.
  • Create specific code for services and tests for this code.
  • Create CI/CD pipelines.

At this moment, many people will say that this is impossible. I will agree with them, but as AI chess history teaches us, this can be a reality in the future (15–25 years from now).

Main players in AI-based software development

How the current state of AI looks like in software development? Here we have many different tools, but I will concentrate on two solutions that can dominate this market. The first is Codex from OpenAI, and the second is AlphaCode from DeepMind.
OpenAI is a research organization that aims to promote and advance the development of artificial intelligence in a way that is safe, transparent, and beneficial to humanity. It conducts research in machine learning, natural language processing, and robotics and develops and releases AI tools and technologies for use by the broader research community and industry. OpenAI strongly cooperates with Microsoft (MS invested $1 billion in OpenAI).
DeepMind is a leading artificial intelligence company founded in 2010 and is now a subsidiary of Alphabet Inc. The company uses machine learning and other advanced techniques to build intelligent systems that perform various tasks, such as language translation, image recognition, and game playing. DeepMind is known for its work in natural language processing, computer vision, and robotics and has made significant contributions to the field of AI through its research and development efforts. The company has also developed several practical applications for its AI technologies, including a system that is used to help reduce energy consumption in data centers.

Open AI Codex

OpenAI Codex is a natural language processing to code system developed by OpenAI based on GPT-3 language model. It is designed to allow users to write code using simple, natural language instructions rather than traditional programming languages.
The Codex system uses advanced machine learning algorithms to understand and interpret human language and can generate code in various programming languages in response to user prompts. This makes it easier for people with limited experience with coding to create software and other applications by simply expressing their ideas in plain English.
As soon as Codex was released through the OpenAI API in August 2021, it quickly gained attention from developers around the world. It was named a game-changer, making it easier than ever before to write code. And it wasn’t just individual developers who were excited about Codex — major companies were also taking notice.
One of these companies was GitHub, the popular platform for developers to collaborate on code. They saw the potential in Codex and decided to incorporate it into a new tool they were developing called GitHub Copilot. Codex became the principal building block of this tool, and it has since become an essential part of the GitHub ecosystem.
GitHub’s recent evaluation showed that, on average, users accepted 26% of the completions suggested by GitHub Copilot. They also found that, on average, more than 27% of developers’ code files were generated using GitHub Copilot, and for specific languages such as Python, that number was almost 40%.
👉 Link to the full description of copilot: https://github.com/features/copilot

AlphaCode from DeepMind

AlphaCode is a system for code generation developed by DeepMind.
The model was designed to address the main challenges of competitive programming, such as: searching in the vast space of possible programs, limited access to example tasks for training, and a restricted number of submissions per problem. It achieved an average ranking in the top 54.3% in simulated evaluations on recent programming competitions on the Codeforces platform, making it the first artificial intelligence system to perform competitively in programming competitions.
Researchers from DeepMind used a large dataset of code from GitHub to train their models to do a better job at writing code. This dataset was enormous, at 715 GB, and they used it to teach their models how to predict the next word in the code. To do this, they split the code files into two parts and used the first part as input for their models. Then, they trained the models to try to write the second part of the code. This helped their models learn how to write code as humans do, so that when they gave them a specific task to do, they would be better at it.
AlphaCode can solve programming problems by generating and analyzing millions of diverse programs using specially trained transformer-based networks. It then filters and clusters these programs, submitting a maximum of only 10 for evaluation.
👉 Full research paper on AlphaCode: https://www.science.org/stoken/author-tokens/ST-905/full

The AI future in software development

While AI has the potential to automate many tasks and make the software development process more efficient, it is unlikely to replace the creativity, problem-solving completely, and critical thinking skills of human developers in the next five to ten years.
In order for AI to completely replace software developers, it would need to be able to perform all of the tasks currently carried out by developers, including:

  • Understanding and interpreting complex requirements and specifications
  • Designing and implementing software solutions
  • Debugging and testing code
  • Collaborating with other developers and stakeholders
  • Continuously learning and adapting to new technologies and methods While AI has made significant progress in some of these areas, it is unlikely to be able to perform all of these tasks at the same level as human developers soon. Overall, AI will likely augment and assist software developers rather than replace them, helping them be more productive and efficient while maintaining the creativity and problem-solving skills essential to the software development process in this time scope. In the long term, 10–25 years from now, this technology will surpass human abilities in this area, as it did in chess in the last 20 years. The AI era has begun…

Top comments (0)