Win 10 game mode: How to enable (or disable) Game Mode in Windows 10 and 11

Is It Good or Bad?

It’s good, but don’t expect miracles

Windows 10 Game Mode is designed to improve performance when gaming, even for lower-end computers. It can help stabilize the frame rate in games that demand more system resources, even if your computer can’t normally handle it.

If you’re running a newer game on an older computer and want to see improved performance, let Windows 10 Game Mode do the work for you. This guide will cover how it works, how to enable it, and how to get the most benefit out of the tool.

Table of Contents

    How Does Windows 10 Game Mode Work?

    If you’ve ever tried to run a game on sub-par hardware, you know the pain of dropped frames and sudden slowdown. Frame drops can mean the loss of a game, especially if you’re up against a boss that relies on sudden reactions — or if you’re in a multiplayer match and you can’t keep up with your opponent on-screen.

    Windows 10 Game Mode works to prevent this from happening by giving the game you’re playing priority access to all system resources, but specifically those from the processor and graphics card.  

    It also has a secondary feature that goes a bit more under the radar: it halts notifications, Windows updates, and driver updates. You won’t receive system notifications and your gameplay won’t be interrupted because your computer decides it’s time for an update out of the blue. 

    Does Windows 10 Game Mode Yield Noticeable Improvements?

    In the modern era, it’s odd that someone plays a game without a web browser pulled up in the background. We use the Internet for everything from sending a quick message to a friend to join our game to looking up how to get past a particularly difficult section of gameplay. The downside, of course, is that web browsers (especially Chrome) can dominate system resources. Windows 10 Game Mode removes this obstacle.

    Powerful Personal Computer Gamer Rig with First-Person Shooter Game on Screen. Monitor Stands on the Table at Home. Cozy Room with Modern Design is Lit with Pink Neon Light.

    That said, if your computer is powerful enough, you might not notice any improvement at all. There is no hard and fast limit on what system specs most benefit from Game Mode, but a good rule of thumb is that if your computer uses hardware that’s more than three or four years old, you will probably see some improvement. 

    One more thing to bear in mind is that not all games are compatible with Game Mode. Microsoft doesn’t provide a list of which games are compatible, but those that are tend to be automatically recognized by Game Mode. What this means is that when you launch a game, Game Mode is enabled by default. 

    If it isn’t, you can turn Game Mode on with ease.

    How to Enable Game Mode

    The good news is that Windows 10 Game Mode is easy to turn on. 

    1. Open Settings.
    1. Select Gaming.
    1. Select Game Mode from the left-side bar.

    Unless you’ve changed the setting in the past, the toggle should already be in the On position. If a glitch has occurred or you’ve accidentally disabled it, you can easily turn it back on with just a few clicks. 

    Once enabled, Game Mode will kick in as soon as you launch a recognized game. If you never play games on your machine, Game Mode won’t yield any benefit — but if you’re a frequent gamer, you might get just that much more performance with it enabled. 

    You can’t turn it on just for individual games — only as a system-wide on or off toggle. If Microsoft releases an update in the future that allows you to individually enable Game Mode through a keyboard shortcut, it may have more use in games.

    Does Windows 10 Game Mode Cause Problems?

    While Game Mode is a mostly-beneficial feature that can and does improve performance, some users have reported errors that only occurred with Game Mode enabled. 

    Some Microsoft updates have temporarily caused Game Mode to have the opposite effect and resulted in lower frame rates, but those were repaired quickly. However, there are anecdotal reports that Game Mode causes the system to slow down overall. If this happens, it’s likely because in allocating more resources to the game you’re playing, Game Mode de-prioritizes important background processes that may result in system-wide effects.

    Most likely, Game Mode won’t cause performance issues when you’re playing your favorite game, and may even help you squeeze a few more frames out of it. If you find that your performance isn’t what it should be, you can disable Game Mode and eliminate it as a variable to find out if it’s the source of the problem.

    If you’re using a program that performs a similar function to Game Mode, like NVIDIA’s GPU Boost, Game Mode might clash with it. By reducing background processes, Game Mode may affect how GPU Boost or a similar program operates. 

    Does Windows 11 have Game Mode?

    Windows 11 also has Game Mode, and it’s found in Settings in the same location as the Windows 10 version. It also functions in the same way, by reducing background processes and focusing the resources on the game.

    While Windows 10 Game Mode won’t work for every game or every player, it doesn’t hurt to keep it enabled. You might see a few more frames than you would otherwise. Still, it isn’t a miracle worker. If you’re trying to run a high-powered game on a PC with the same specs as a toaster oven, you won’t suddenly go from 3 frames per second to 30. 

    ‘;document.getElementsByClassName(«post-ad-top»)[0].outerHTML=»;tocEl.outerHTML=tocHTML+newHTML;}}catch(e){console.log(e)}

    Patrick is an Atlanta-based technology writer with a background in programming and smart home technology. When he isn’t writing, nose to the grindstone, he can be found keeping up with the latest developments in the tech world and upping his coffee game. Read Patrick’s Full Bio

    Subscribe on YouTube!

    Did you enjoy this tip? If so, check out our very own YouTube channel where we cover Windows, Mac, software, and apps, and have a bunch of troubleshooting tips and how-to videos. Click the button below to subscribe!

    Subscribe

    How to Optimize Windows 10 for Gaming and Performance

    Windows 10 is a great OS for gamers, mixing native games, supporting retro titles, and even Xbox One streaming. But it isn’t perfect straight out of the box.

    Some tweaks are required to enjoy the best gaming experience Windows 10 has to offer. Here are several ways to optimize your Windows 10 PC for gaming.

    1. Optimize Windows 10 With Gaming Mode

    Looking for another option to squeeze the best gaming performance out of Windows 10?

    Game Mode is one of the key Windows settings for gaming. When you’ve Game Mode turned on, your Windows settings are tweaked in a way that optimizes your Windows 10 performance. In a nutshell, it works by managing your system resources and thereby giving you the best performance on your PC. Here’s how:

    1. Press Windows key + I to launch Windows Settings.
    2. Type in ‘game mode’ in the search box.
    3. Click Game Mode settings or Turn on Game Mode.
    4. On the Gaming screen, click Game Mode.
    5. Switch to On to use Game Mode.

    If your PC supports Game Mode, resources will be managed to achieve the optimum frame rate. Additionally, Windows Update will be suspended.

    While this is one way to improve gaming performance on Windows 10, Game Mode is not perfect. Jump to the next section to learn some more Windows 10 gaming tweaks.

    2. Improve Online Game Performance: Disable Nagle’s Algorithm

    Nagle’s algorithm essentially bundles data packets at the cost of a smoother internet connection. It’s useful but having Nagle’s algorithm enabled on your computer may contribute to latency issues when playing games online.

    To disable this and improve gaming performance on Windows 10, start by checking your IP address:

    1. Hit the Windows key + X keys.
    2. Select Windows PowerShell.
    3. Type in «ipconfig» and hit Enter.
    4. Look for «IPv4 address» to identify your PC’s IP address

    With the IP address noted, it’s time to edit the Windows Registry. However, be super careful before you make any changes to the Registry, as things can easily go haywire. Here’s how.

    1. Head to the Start menu search bar, type in ‘regedit,’ and select the best match.
    2. Select Registry Editor (tread carefully when fiddling with the Windows Registry)

    In the address bar, copy and paste the following path:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces 

    In the left-hand pane, you’ll see a collection of folders, with filenames comprised of letters and numbers. To access the correct file, match your IP address with the one listed against DhcpIPAddress in one of these folders.

    When you find your matching folder:

    1. Right-click on the folder
    2. Select New > DWORD (32-bit) Value
    3. Name this TcpAckFrequency
    4. Click OK
    5. Select New > DWORD (32-bit) Value again
    6. Name this one TCPNoDelay.
    7. Double-click on each and set their parameters to 1

    That’s it. Do this and you will disable Nagle’s Algorithm. If you run into any problems, reset the parameter values to 0, and they will be disabled.

    3. Optimize Windows 10 Online Gaming With Faster DNS

    If you’re playing online multiplayer or relying on a remote server for Windows 10 gaming, network traffic can cause problems.

    While upgrading to faster internet can help, it’s quicker and cheaper to just make some networking tweaks.

    1. Hit Windows + I to open the Settings app.
    2. Find Network and Internet > Change Adapter Settings.
    3. Right-click on your wireless network.
    4. Select Properties.
    5. Highlight Internet Protocol Version 4.
    6. Make a note of the two DNS entries for future reference.
    7. Replace them with 1.1.1.1 and 1.0.0.1
    8. Click OK, and then select Close.
    9. Restart your default browser.

    Your internet should now be faster, which will help with online gaming.

    4. Disable Automatic Updates for the Best Gaming PC Settings

    Windows 10 will automatically update your OS and schedule a restart without your permission. While this feature doesn’t activate often, you never want to be caught unaware and risk your game save.

    Not only can automatic updates restart Windows without warning, but downloading updates in the background will limit your network connectivity.

    While you cannot disable automatic restart, it can be delayed. To reduce the chance of Windows Update downloads interrupting your gaming performance:

    1. Open Settings with Windows key + I
    2. Click Update and Security > Windows Update
    3. Look for Advanced options then click Update Options
    4. Disable Restart this device as soon as possible when a restart is required to install an update
    5. Enable Show a notification (Windows will give plenty of warning when the system is going to restart following an update)
    6. Use Pause updates to delay installation of updates for up to 7 days

    By specifying when you’ll be using Windows 10, you can prevent Windows Updates from downloading and installing during active hours.

    5. Disable Notifications in Windows 10

    The Focus Assist feature in Windows 10 lets you specify how and when you receive notifications.

    Popups and chimes usually accompany notifications, but these can interrupt games. Focus Assist lets you manage what level of focus you devote to your work. To optimize your Windows gaming with Focus Assist, follow the steps below:

    1. Hit Windows + I to open Settings.
    2. Click System > Focus Assist.
    3. Select Alarms Only to hide all other notifications.
    4. Ensure When I’m playing a game is set to On.

    That’s it. This will minimize the impact of notifications, making them available to check later.

    6. Prevent Steam Auto-Updating Games

    If you use Windows to play games, you’re probably buying and installing games via Steam.

    One of the largest annoyances with Steam is its update feature. This blocks you from preventing automatic updates across all your games. This may eat up memory by updating games you don’t play or limiting your network connectivity with background updates.

    To prevent Steam from updating games in the background:

    1. Launch the Steam client.
    2. Open Steam > Settings > Downloads.
    3. Uncheck Allow downloads during gameplay.

    You can also prevent Steam from downloading updates for largely unused games:

    1. Open the Steam Library.
    2. Right-click an underused but installed game.
    3. Select Properties then Updates.
    4. Under Automatic Updates change Always keep this game up to date to Only update this game when I launch it.
    5. Ensure Pause background downloads while I’m playing is selected under Background Downloads.

    With Steam correctly optimized, Windows 10 will be ready for AAA gaming.

    7. Tweak Windows 10 Visual Effects for Game Improvements

    Your computer’s graphical user interface (GUI) can be a hindrance to your processing power. By default, your Windows 10 appearance settings are set to impress.

    Games running in the foreground may conflict with a shiny GUI running in the background. Adjust these settings to optimize Windows 10 for gaming performance.

    1. Open Settings with Windows key + I.
    2. Type in «performance» and select Adjust the appearance and performance of Windows.
    3. In the settings box, select Adjust for best performance.
    4. Click Apply.
    5. Click on the Advanced tab.
    6. Ensure that Adjust the best performance of is set to Programs.
    7. Apply again, and then click on OK to confirm.

    2 Images

    8. Tweak Your Mouse Settings for Windows 10 Gaming

    Could your mouse be impacting gaming performance on Windows 10? To find out, it’s a smart idea to optimize your mouse settings. A feature called pointer precision, also known as mouse acceleration, can impact how your mouse performs in games; Disabling it can help to optimize gaming in Windows 10. Here’s how you can do that:

    1. Open Settings.
    2. Click Devices > Mouse.
    3. View the Pointer Options tab.
    4. Clear the Enhance pointer precision checkmark.
    5. Click Apply.
    6. Click OK to exit—you might also adjust the pointer speed to suit.

    If gaming has improved, your mouse was almost certainly slowing things down.

    9. Max Power Plan to Improve Windows 10 Gaming Performance

    Power options are often ignored due to their supposedly negligible effect. Some gamers claim adjusting for higher performance works, while others fail to notice any difference by changing their PC power settings.

    The only way to know for sure is to test it out on your PC. To change your power settings:

    1. Open Settings.
    2. Type in «power» and click Power & sleep settings > Additional power settings.
    3. Select the high-performance option.
    4. If none is available, use Create a power plan to configure a new, custom power plan

    This option will allow your PC to perform better at the cost of higher energy consumption and temperature levels. For this reason, it’s better to activate this Windows 10 optimization on the desktop rather than on laptop PCs.

    10. Keep Your Windows 10 Drivers Updated for Improved Gaming Performance

    Your GPU (Graphics Processing Unit) is the core of your PC gaming experience. However, the GPU requires the latest Windows driver to keep it working faster and better.

    All graphics cards, no matter how old or new, benefit from continually updated drivers.

    To check your GPU name and specs:

    1. Right-click Desktop
    2. Select Display settings > Advanced display settings
    3. At the bottom, find Display adapter properties

    You can download driver updates through this window under Properties > Driver > Update Driver. Alternatively, visit the manufacturer’s website to ensure the driver is up-to-date.

    Manufacturers will often provide free gaming and update software to keep your drivers up to date automatically. For optimal performance, it is highly recommended that you install the chipset and LAN drivers for your motherboard as well. Since these are crucial for optimal gaming performance, this makes sense.

    The easiest method to check chipset drivers is to open Windows PowerShell (right-click Start to find it) and enter:

    wmic baseboard get product,Manufacturer,version,serialnumber 

    Your motherboard’s manufacturer and product name will appear in the command prompt.

    List your manufacturer and product name to search for your drivers online. You should find the necessary software on the Support page of the manufacturer’s website.

    Along with the chipset drivers, you will also find your onboard LAN drivers for an optimal internet connection.

    11. Install DirectX 12 to Optimize Windows 10 for Gaming

    DirectX 12, the latest version of Microsoft’s popular gaming API, is a key element of Windows 10 gaming.

    It delivers support for multiple GPU and CPU cores, better frame rates, lowered power consumption, and enhanced graphical effects.

    To check if you have the latest version of DirectX:

    1. Open Windows PowerShell
    2. Type dxdiag
    3. Tap Enter

    Moments later, you’ll see the DirectX Diagnostic Tool.

    Don’t have DirectX 12 installed? There’s a small chance this can happen if you have upgraded from Windows 8.1. Fix this by:

    1. Opening Settings with Windows key + I.
    2. Select Update and security.
    3. Find Windows Update > Check for updates.

    That’s it. Wait while the update installation gets completed. DirectX12 will automatically optimize many gaming settings in Windows 10.

    Now You Know How to Optimize Your PC for Gaming

    Windows 10 has been a major legitimate delight for the modern gamer. With a towering game selection, Xbox One compatibility, and software specifically designed for gaming, it’s clear the gamer community has always had a special place for Windows 10. However, nothing’s perfect. And that’s exactly the reason Microsoft came up with Windows 11, a significant ramp-up for Windows gamers all over the world.

    How to enable game mode in Windows 10

    How to enable game mode in Windows 10 — in order to answer this question, let’s first understand what it is and why is it needed? Game mode is a mode of operation of the system designed to improve the performance of the computer when running game programs.

    It appeared after the Windows 10 Creators update, which added the game mode. In addition to the game mode, a large number of new useful features and improvements have been introduced to the system with this update. nine0003

    Start the game mode and enjoy the high performance of your computer — now it’s possible. There are dozens of programs constantly running in the background in the system that can affect the performance in games.

    The game mode is designed specifically for the maximum release of the computer from most processes, it prioritizes the game, thereby significantly increasing the performance of your computer.

    Game mode test

    Game mode in Windows 10 can be assessed by benchmarks. Tests show that after activating the game mode, the frame rate per second increases, “freezes” or freezes, slowdowns in games are also significantly reduced.

    The following instructions will allow you to activate the game mode. Repeat exactly all the steps for us:

    • You need to make sure that the games menu is displayed on your computer — open the Start menu, go to settings and open the Games tab.
      nine0022

    • It is necessary to check if the «Game Mode» is enabled and move the slider
    • Check the box «Display game menu during full screen playback».
    • Launch any game, the menu works even in games not purchased from official stores.
    • Next, you need to open the game menu, which is opened by simultaneously pressing the [Win] + [G] keys.
    • Next, we find the gear sign on the panel, click on it and get into the settings. Here we put a tick in front of the item «Use game mode for this game.»
      nine0022

    On a PC, enable Game Mode in Windows 10 in the same way as on a laptop. Let’s emphasize that to enable the game mode (to open the game mode settings window), you need to run the game in frameless windowed mode, after completing the last step and saving the changes, you can return the full screen size.

    How to install game mode in Windows 10 can be seen in detail in the video. Even a beginner can handle it.

    The Game Mode in Windows 10, which was released on January 21, 2017, was only presented to the public, its capabilities were only described. When, nevertheless, the game mode was released on Windows 10 for everyone — on April 11, users were able to try it out on their computers. nine0003

    How do I disable Game Mode in Windows 10?

    Turning it off is simple — we fulfill all the conditions as when turning it on, except for the last step. There, instead of checking the box, we uncheck it, so the game mode will be disabled.

    The Xbox DVR feature is now available with the update. It allows owners of Xbox portable game consoles and Windows 10 OS to assign keyboard shortcuts in order to record sound and video from the screen, as well as save screenshots. If you are not involved in recording gaming videos or streaming, then this program will only spoil your life by loading the system with unnecessary processes. This is subtle on powerful machines, but the weaker your computer, the more noticeable the difference in system performance after disabling Xbox DVR. nine0003

    For more information on how to disable Xbox DVR in Windows 10 you can learn from the article on our website, and now a brief instruction. So, you need to do the following:

    • Find and open the official Xbox application, register with the Microsoft service.
    • After launching the application, you need to go to its settings, find and open the «Game DVR» tab, you need to turn off this function, there will be a switch under the tab.
      nine0022

    • If you don’t use this program at all, you can uninstall it:
      • Type «Powershell» in Windows search and open the console.
      • In the console, write a command to remove the application (it is standard in the system and cannot be removed in any other way): [Get-AppxPackage *xbox* | Remove-AppxPackage], without square brackets.
      • Reboot the PC.

    The full version of the article about how to remove the Xbox is posted on our portal. nine0003

    Finally, I want to tell you what games are available on Windows 10 — read a more detailed article on our website, and now a few words, so all games compatible with Windows 7 and Windows XP run on the new system without problems . Starting with Windows XP, all games and programs are guaranteed to run on the new system, but all earlier applications are not able to work on Windows 10, you can only look for their modern counterparts. Some games are specifically designed for Windows 10 and can only be played on that operating system. nine0003

    Gomoku winning strategy — 35 moves The article presents to your attention a complete winning strategy and the corresponding game algorithm.

    Demonstration of the full solution — here — you can play around and find the longest options. The program always wins and spends no more than 35 moves on it. The source texts of the application, the solution itself and examples of games at the end of the article. nine0095
    I will not dwell on the rules and tactics of the game. The topic was discussed in detail on habr here, as well as solution algorithms here and here.

    Small deviation

    Before the era of smartphones, tic-tac-toe «five in a row» (Gomoku, Renju) was one of the most popular time killers in the classroom at school. Counting combinations was more interesting than the development of the national economy of North Africa or the classification of clover flowers.

    In the autumn of 1985, the girls from our 10″b» were taken away from the mathematics lesson. We, the remaining six children, were most likely to have informal communication with a mathematics teacher on abstract topics. The teacher entered the class in silence, handed out checkered papers to everyone, and began to write the names of those present on the blackboard. We were depressed, independent work or a blitz survey was planned. But the list on the board turned into a tournament table and the rules of the championship were announced to us. Each with each series of five batches. Prize for the winner — five in the magazine. According to the results of the tournament, I was lucky to win, but the game did not end there. The teacher promised to put fives to all the guys if the winner wins all five games of the series in a row. The right of the first move is given to the winner. Contrary to the assertion of our teacher that on such a condition, with correct play, one can win 10, and 100, and in general any number of games in a row, victory seemed to me incredible luck. nine0003

    Nine years later, in 1994, Dr. Lewis Victor Allis stated that there was evidence for this hypothesis in the article Go-Moku and Threat-Space Search. The author did not publish the winning strategy he obtained, which makes it possible to verify the proof. However, in the book Searching for Solutions in Games and Artificial Intelligence, published by him in 1996, a general description of the algorithms was given. In conclusion, a procedure for checking the completeness of a winning strategy is mentioned separately, which is based on the correctness of the implementation of the algorithm for searching for a «sequence of threats» and the analysis of opponent’s counterplay options. nine0003

    The examples of decisions given in the article and the book with the “correct moves” of the opponents, which are part of the winning strategy, demonstrate the weakness of the algorithms used.

    For example, the figure shows the solution of the program for the standard Gomoku rules. If, in response to White’s 10th move g9, Black responds with j10 and then j8, then the game ends in 29 moves instead of 45. Then the program «did not notice» the combination of Black’s «sequence of threats» twice in 17 moves after the 16th and after the 26th White’s first move. And finally, if White makes the 36th move f12 instead of j12, then he will hold out until at least 49th move. To be fair, in this example, all Black’s moves leave White no chance to complete the game in his favor.

    On the Internet, I found several references to similar works in the search for a winning strategy. The question of the optimality of the solutions found remains unresolved. What is the minimum number of moves Black needs to win?

    So, having some free time, modern computing resources, and paying tribute to children’s hobbies 33 years after the memorable school championship, I set the task of finding an optimal strategy for winning with Black in Gomoku. nine0003

    Digitize the position on the board

    The recording of the party is rather primitive. There are only 225 cells on the field. Accordingly, each cell is encoded with 1 byte. To record a game of 35 moves, only 35 bytes are required. But such a notation is ill-suited for assessing a position for two reasons: the same position can be obtained in a different sequence of moves, and symmetrical positions are not taken into account.

    Achieving the goal of the game — building five stones in a row — can be carried out in one of four directions: vertically, horizontally and along two diagonals. Thus, we can represent any position as a set of lines. Horizontal and vertical lines 15 cells long and diagonal lines 1 to 15 cells long. Each move changes the value of 4 lines at once in different directions. nine0003

    The task of evaluating a position is to determine all significant figures for each line. For simplicity, each cell of the line is described by 2 bits. The first bit is filled when the white stone is set, the second bit is filled with the black stone. Each line contains no more than 15 cells and is encoded in a 32-bit integer. Thus, the search for figures on the line is reduced to comparing the numerical value of the line through a sliding window with the bit pattern of the figure.

    In the example shown in the figure, the position is described by 26 lines. Accordingly, it is encoded in 104 bytes, while a normal batch recording requires only 17 bytes. nine0095
    It is easy to guess that all symmetries — rotations and mirror images — are obtained by simply changing the number (shuffling) and direction of the lines. To identify a position and quickly search in collections, a 32-bit hash function is implemented on this principle, which gives different values ​​only for asymmetric positions.

    The use of symmetries significantly reduces the number of positions considered. For example, the number of options for the second move is reduced from 224 to 35.

    When searching for solutions and combinations (this will be discussed below), the calculated positions make up the vertices of a multilayer graph. Vertices are grouped into layers according to the number of filled cells. The moves make up the edges of the graph connecting the vertices of adjacent layers. When unsuccessful moves are discarded during the search, the edges are removed and some of the vertices lose their connection with the main branch. Therefore, after the calculation steps, garbage collection (or graph rebuilding from the top) is performed.

    Several coding algorithms were considered during the development process, but the one described above showed the highest position estimation speed. nine0003

    Evaluating the position

    An important factor for evaluating a position is how significant the opponents have built pieces.

    Five — if such a piece is found on the board, the game is over. For standard Gomoku rules, no sixes, sevens, etc. give a win. Therefore, the five, as well as all other figures, requires the absence of their stones on neighboring cells in the line.

    Open four — length 6 cells, the middle four are occupied by stones of the same color, the outer ones are always empty. Well, as for the five, their stones are absent on neighboring cells. A very strong figure means winning even on someone else’s move. nine0003

    Four — 5 cells long, one (any) of the five cells is free. Gives a win on its turn. Creates a threat and forces the opponent to make a move to a free cell if he does not have his four. Gives 5 points to position rating when defending.

    Open three — length 6 or 7 cells, the outer cells must be free. For 6 cells, three of the four middle ones are occupied by stones of the same color, one is free. For 7 cells — three middle ones are occupied by stones of the same color. A piece on its move becomes an open four if the opponent does not have a four or an open three. On someone else’s move, it creates a threat and forces the opponent to close the three or put his four in response. A 6-cell triple has 1 up move and 3 closing moves. The 7-cell triple has 2 up moves and only 2 closing moves. Gives from 2 to 4 points in the ranking position. nine0003

    Three of a kind , or a closed three — a length of 5 cells, any three of which are occupied by stones of the same color. A three on its turn can be turned into a four and is used in attack and defense, creating a threat more than an open three of the opponent. Gives 1 point to the ranking position.

    Open (promising) deuce — from 6 to 7 cells long. When attacking, it is converted to an open three. Gives 1 or 2 points to the ranking position. nine0003

    Fork — two or more threats at the same time that cannot be closed in one move. There are 3×3 surebets (two open triples), 3×4 (open three and four) and 4×4 (two open fours. Surebets give a win if the opponent does not have a greater threat — a four or an open three for a 3×3 fork, or the opponent cannot consistently close the fork, creating big threats — a sequence of fours for a 3×3 fork

    The combination is a continuous sequence of threats and defenses against more significant threats of the opponent, leading to a positive result for the player. Combinations are attacking (or winning) and defensive.

    An attacking or winning combination is successful if any defensive or attacking moves of the opponent have been found in return moves leading to a win. An attacking combination ends with a fork that the opponent cannot close. nine0003

    A defensive combination, on the contrary, is successful when the opponent stops creating threats, or the limit of moves for calculation is exceeded. A defensive combination consists of moves to defend or create a greater threat to the opponent.

    When evaluating a position, a search is made for a winning combination. If successful, we won. Otherwise, if there are no threats from the opponent, the state is neutral. If there are threats from the opponent, we search for a defensive combination. In case of success, the state is neutral; in case of failure, we lose. nine0003

    Since the number of options for attacking and forced response moves is quite limited, it is permissible to search for combinations to a fairly large depth. During the initial construction of the optimal strategy, the allowed depth of the search for combinations was set to more than 25 moves. When recalculating the solution for the implementation of the position estimation algorithm in javascript, the allowable search depth was reduced to 17 moves.
    When calculating the optimal strategy, the depth of the search for a winning combination from above was additionally limited by the target maximum number of moves. nine0003

    Looking for a solution

    So, we have assessed the given position as neutral and choose what the next move will be. Our behavior in this case depends on whether we are the attacking or defending side. For the attacking side, a complete solution will be a sequence of moves in which for any counter move of the opponent the position is evaluated as a winning one (a winning combination is found) or contains the next own move in the solution. It is worth noting that in order to calculate the optimal strategy, the attacking side is always black, while the defending side is white. nine0003

    The attacking side needs to find only one move leading to the fastest victory. In conditions of lack of resources, the attacking side artificially limits the number of options for enumeration, first of all, I examine the moves that lead to the position with the highest rating score. After any solutions are found, in the direction of the longest of them, the attacking side expands the set of options, examining less rated positions in order to achieve a reduction in the length of the solution. nine0003

    It is enough for the defending side to find one single move that does not lead to the victory of the opponent within the given limit of moves. All free cells can be used for enumeration.
    To reduce the iterated number of defense moves, we use the “pass move” algorithm. We skip a defensive move and look for a winning attacking combination. If successful, the possible defense moves can be limited to moves that affect the success of the found combination. On average, at each step, this allows you to reduce the search area by 4-6 times. It should be taken into account that among the ignored moves there may be longer branches of the solution. Therefore, to search for optimal solutions, the “skip move” algorithm is used only in the primary search. nine0003

    Calculate strategy

    All the components are ready, we put the first black stone in the center of the field, start the search for a solution, and … On this, after a few hours, the resources of my laptop run out and I have to admit defeat «in battle, but not in battle.»

    To tell the truth, I had computing power at hand with one and a half hundred Xeon cores and a terabyte of free RAM. But, remembering that in the mid-nineties, Allis had only 10 SUN SPARCstation 2 with 128 MB of RAM each, felt remorse for unsportsmanlike behavior and decided to limit the amount of RAM on the java machine to 1 GB and allocated only 1 thread for the task processor. This somehow could compensate for my GHz compared to his MHz. Plus, I made a promise to myself at the end of the work to translate the algorithms into javascript for the browser. nine0003

    So, the search for strategies had to start with solving the opening etudes. A detailed description of openings for the game of Renju in Russian can be found in Sagar’s well-known books «From the Opening to the Middlegame» and Mikhail Kozhin and Alexander Nosovsky «The Ringing of Stones» here. The books are already 20 years old, but since then there has been little such literature. A more recent collection by Dmitry Epifanov «Tiger in a cage» in 2015, unfortunately, is not available in electronic form.

    The search for optimal opening solutions was performed according to the following algorithm. At the first step, a preliminary calculation was performed without limiting the length of the batch. Then, for the longest solutions, optimization was performed: replacing the found combinations with shorter solutions for the final steps and searching for shorter decision branches for all intermediate moves. Optimization was performed until the target limit was reached for all branches of the solution. Then the target limit was reduced and an attempt was made to optimize to a new value. nine0003

    No problem with the 3rd vertical opening shown in the picture. It turned out a complete set of solutions. The most difficult positions after the 4th move i8 and j10 as a result were solved in 31 moves. Then the target limit was set at 35 moves per game.

    Of the diagonals, I traditionally chose the 7th opening for the solution. The most difficult position occurs after the 4th move g9. Solutions of admissible length were found for 6 moves g8 and g7. nine0003

    But for this variation of the 6th move on j9, I could not find solutions shorter than 33 moves. It was almost a disaster. Out of desperation, I tried solutions for the alternative 5th move, as well as all other types of diagonal openings. Openings were decided to the end, but nothing shorter than 39 moves per game could be found.

    Returning to the original 7th diagonal opening, I reworked the algorithm for generating sentences for attacking moves. As a result, moves leading to positions with a rating score of the third ten suddenly began to give results and reduce the length of the solution path. The variability of the calculation with such a quantity became quite large. With a solution depth of 12 moves, there were more than 2 million positions (excluding positions when searching for combinations). The continuation rested on the 1GB of RAM allocated for the task. Thus, in some cases, in order to check the solution before the final fork, it was necessary to separately solve positions from the 18th move. nine0003

    After the 7th diagonal opening was solved in the given 35 moves, it was possible to celebrate the victory — the fight for the center was won. There was still a large amount of routine computational work ahead, calculations of White’s «non-optimal» moves to complete the strategy. Of the total volume of the optimal strategy, the response to such moves as a result was 80%. Fortunately, they were automatically solved completely on the preliminary calculation after the 2nd move, and all this volume was added to the optimal strategy in a couple of days. nine0003

    So, solutions for all 2 moves are found. We put the first black stone in the center of the field, start the search for a solution, and we don’t even have time to feel the importance of the moment — the initial position is solved in 35 moves. The graph of the optimal winning strategy is constructed.

    Testing ourselves

    The next step is to test the solution. We completely turn off the intelligence of the defending side. After each move by Black, White moves to any free square on the board. The position obtained after White’s move must either be found in the decision column or evaluated as winning for the number of moves not exceeding the longest branch in the original position. When evaluating each position, we check the found winning combination for all allowed White moves until Black builds the final piece — five in a row. nine0003

    Verification was performed several times until complete. The final error-free run in single-threaded mode took 14 hours. In the course of the check, errors were found and corrected that arose as a result of differences in the depth of the search for combinations, assumptions of skipping a move, duplication of symmetrical positions.

    Answer the question — is a solution in 35 moves really the most optimal. According to my research, for a number of the longest branches of the vertical opening, it is possible to find more optimal solutions with a length of 33 moves. But for the diagonal after the 6th move on j9a lot of time was spent on finding a solution in 33 moves, the variability for black was expanded to 50 moves at each step and to no avail. It is not possible to strictly prove the absence of a solution in 33 moves, the time allocated for the project came to an end and the decision was made to stop at the target limit of 35 moves.

    Convert from java to javascript

    The publication of the solution of the problem requires visibility. To use the solution directly in the browser required:

    • Reduce the search depth for combinations when evaluating positions to 17 moves. This led to a 2-3 times increase in the number of precalculated moves of the optimal strategy.
    • Convert binary decision graph format to JSON sequence of moves. This format is more convenient in javascript and visual.
    • Convert java classes to javascript modules, except for solvers. Here, in the web interface, replace calls to rest services with local functions.