Artificial intelligence (AI) is an area of [computer science](compsci.md) whose effort lies in making [computers](computer.md) simulate thinking of humans and possibly other biologically [living beings](life.md). This may include making computers play [games](game.md) such as [chess](chess.md), compose [music](music.md), paint pictures, understand and processing audio, images and text on high level of [abstraction](abstraction.md) and understanding (e.g. translation between natural languages), making predictions about complex systems such as stock market or weather or even exhibit a general human-like behavior. Even though today's focus in AI is on [machine learning](machine_learning.md) and especially [neural networks](neural_network.md), there are many other usable approaches and models such as "hand crafted" state tree searching algorithms that can simulate and even outperform the behavior of humans in certain specialized areas.
There's a concern that's still a matter of discussion about the dangers of developing a powerful AI, as that could possibly lead to a [technological singularity](tech_singularity.md) in which a super intelligent AI might take control over the whole world without humans being able to seize the control back. Even though it's still likely a far future and many people say the danger is not real, the question seems to be about *when* rather than *if*.
By about 2020, "AI" has become a [capitalist](capitalism.md) [buzzword](buzzword.md). They try to put machine learning into everything just for that AI label -- and of course, for a [bloat monopoly](bloat_monopoly.md).
By 2023 neural network AI has become extremely advanced in processing visual, textual and audio information and is rapidly marching on. Networks such as [stable diffusion](stable_diffusion.md) are now able to generate images (or modify existing ones) with results mostly indistinguishable from real photos just from a short plain language textual description. Text to video AI is emerging and already giving nice results. AI is able to write computer programs from plain language text description. Chatbots, especially the proprietary [chatGPT](chatgpt.md), are scarily human-like and can already carry on conversation mostly indistinguishable from real human conversation while showing extraordinary knowledge and intelligence -- the chatbot can for example correctly reason about advanced mathematical concepts on a level much higher above average human. AI has become [mainstream](mainstream.md) and is everywhere, normies are downloading "AI apps" on their phones that do funny stuff with their images while spying on them. In games such as [chess](chess.md) or even strategy video [games](game.md) neural AI has already been for years far surpassing the best of humans by miles.
As programmers let's first answer ourselves this: what really is AI to us? A programmer/mathematician typically simplifies AI to mean only this much: **making decisions**. I.e. let's forget human brain, emotion, psychology and all this kind of stuff for a second and focus only on one thing: decision making, and how to program computers so that they make an intelligent decision from input data. Every single "AI" system never does anything more than just take a look at current situation (state, context, data, ..., just a bunch of numbers) and from all possible actions that may be taken from here it tries to pick the best one (i.e. output another number). Whether it's making the best move in [chess](chess.md), deciding which animal is captured in a photo, choosing how to translate a word from English to Spanish or choosing what pixel to draw on the screen so that the result will resemble human art, the problem is always reduced to only deriving a number from some other numbers.
AI to us is therefore nothing more than a mathematical [function](function.md) of state, outputting action (leading to another state). Also we will require this function to be pure, true and [deterministic](determinism.md) mathematical function, i.e. without any [randomness](randomness.md), hidden state etc., i.e. the function will always return the same result for the same input, the input depends SOLELY on the state we give it. In an extreme case every AI that works with finite memory could then literally be just a [table](lut.md) defining best action for any state -- but of course, such tables would be big and hard to make manually, so we typically try to create [algorithms](algorithm.md) that do the job of such table without taking so much space.
NOTE: Of course we sometimes want randomness, for example in chess we may want our AI to sometimes make a different move in the same position, but this added randomness always can (and SHOULD) be implemented outside of our AI function -- we may for example add an extra [seed](seed.md) parameter to our AI which will affect its choice, or we could make an AI that only ranks the quality of each move and then make our chess bot (built on top of this AI) randomly choose from let's say 3 best moves as judged by the AI.
The "modern" machine learning ([neural network](neural_net.md) etc.) AI is no exception here, neural network also implements a pure mathematical function in this sense. That is we are still facing the same problem, we are just trying to solve it by training a network that will make good choices. This approach is mostly about creating a good structure of the network, with good parameters (like number of neurons, layers etc.), encoding the states in good ways (i.e. mapping real world problems to numbers representing the state) and then training the network well, i.e. using right data sets, training algorithms etc. This art is very complex and can't be detailed here in depth.
The traditional non-machine-learning approach is a bit different -- it is based on manually programming **[state space search](state_space_search.md)** algorithms rather than training models. From [LRS](lrs.md) point of view this is probably the **more [KISS](kiss.md) way**, i.e. preferable, sufficient for many types of problems without needing extremely powerful machines or huge datasets. In essence we do this: we realize the states are basically nodes and actions are connections between the nodes, i.e. we get a **state space** which is a methematical **[graph](graph.md)**. Our program is always in some state, i.e. in some node, and the actions it may take are paths it may take in the graph, so really our AI is helping us travel through the graph so that we get from whatever state we're in to a better one (ideally best possible). Many different algorithms, [heuristics](heuristic.md) and optimizations exist here such as [depth first search](dfs.md), [breadth first search](bfs.md), [Monte Carlo](monte_carlo.md), [minimax](minimax.md) with alpha-beta pruning etc. -- they typically just [recursively](recursion.md) traverse the local space, i.e. take a look at states near the current one, and then say in which direction the best state lies. Let's remind ourselves this doesn't just have to be chess and chess moves, this may apply to flying a virtual plane or solving an equation. Again, the whole art of state space search can't be covered here in depth.
To sum up let's again compare the two mentioned approaches on the example of chess. Neural network machine learning will try to train a network (we could almost say by just [brute force](brute_force.md) trying many different parameters for the network) that takes a look at the chess board (which will be encoded into numbers) and then, by some kind of complex "[magic](magic.md)" that's really hidden from us somehow outputs the correct move (well, in practice it rather just scores the position, but let's neglect this now). Training such network will take a lot of time, data and electricity; it will result in a network that will pick good moves without us knowing HOW it really works (we just know it does), and the network will be just a network that filters input numbers into an output number. The traditional state search approach, on the other hand, will rather be a hand-made algorithm that will check all possible moves to certain depth and then return the move that it found will lead to a position that looks the best. I.e. here we know exactly what's going on, we have an algorithm simulating the human move calculation (looking ahead in the game for good moves), and the algorithm works iteratively, i.e. it has to perform many steps and playouts to actually see how to game evolves with different moves.
NOTE: State search is sometimes combined with neural networks -- good chess engines for example still do traditional state search but employ a neural network to decide how good each position is. This way we get the best of both world.