Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 789509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:32:08+00:00 2026-05-14T21:32:08+00:00

Way way back (think 20+ years) I encountered a Gomoku game source code in

  • 0

Way way back (think 20+ years) I encountered a Gomoku game source code in a magazine that I typed in for my computer and had a lot of fun with.

The game was difficult to win against, but the core algorithm for the computer AI was really simply and didn’t account for a lot of code. I wonder if anyone knows this algorithm and has some links to some source or theory about it.

The things I remember was that it basically allocated an array that covered the entire board. Then, whenever I, or it, placed a piece, it would add a number of weights to all locations on the board that the piece would possibly impact.

For instance (note that the weights are definitely wrong as I don’t remember those):

1   1   1
 2  2  2
  3 3 3
   444
1234X4321
  3 3 3
 2  2  2
1   1   1

Then it simply scanned the array for an open location with the lowest or highest value.

Things I’m fuzzy on:

  • Perhaps it had two arrays, one for me and one for itself and there was a min/max weighting?
  • There might’ve been more to the algorithm, but at its core it was basically an array and weighted numbers

Does this ring a bell with anyone at all? Anyone got anything that would help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:32:09+00:00Added an answer on May 14, 2026 at 9:32 pm

    Reading your description, and thinking a little about it, I think it probably works with a single array, exactly the way you described.

    To accomplish the goal of getting five-in-a-row you have to (a) prevent the opponent from succeeding and (b) succeed yourself.

    To succeed yourself, you have to place stones near other stones you already have on the board, so it makes sense to add a positive score for fields next to your stones that could participate in a row. Either the linear example you gave, or something quadratic would probably work well.

    To prevent your opponent from succeeding, you have to place stones next to his / her stones. It’s especially good if you strike two birds with a single stone, so opponent’s stones should increase the value of the surrounding fields the same way yours do — the more stones he already has lined up, the higher the score, and the more likely the algorithm will try to cut the opponent off.

    The most important thing here is the weighting of the different fields, and whether the opponent’s stones are weighted differently than yours. Unfortunately I can’t help with that, but the values should be reasonably simple to figure out through trial and error once the game itself is written.

    However this is a very basic approach, and would be outperformed by a tree search algorithm. Searching Google, there’s a related paper on Threat search, which apparently works well for Gomoku. The paper is behind a pay-wall though :/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read that way back programmers have to think of special names for their
I have a Flash game I made way back in 2008. It runs super
I have some PL/SQL code that I think might have a memory leak. Everytime
I remember from way back at university using a switch with 'binary search' or
I have no clue about trigonometry, despite learning it in school way back when,
Is there a way to respond to the back button being hit (or backspace
Is there a way to pass a call back function in a Java method?
The back button just causes my page to refresh. Is there a way around
What is the approved way to convert from char* to System::string and back in
Is there a way (hacky will do) to allow a user to go back

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.