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 6697505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:28:03+00:00 2026-05-26T06:28:03+00:00

i am writing algorithm for puzzle game.I am putting puzzles in spiral in this

  • 0

i am writing algorithm for puzzle game.I am putting puzzles in spiral in this manner:

[07][08][09][10]      
[06][01][02][11]
[05][04][03][12]
[16][15][14][13]

Example

  1. puzzle in place [02] must fit its west edge to puzzle [01] east
    edge;
  2. puzzle in place [06] must fit its east edge to puzzle [01] west edge; and its south edge must fit puzzle [05] north edge.

I will have unpredictible number of puzzles from whitch I will always try to form biggest square.
I ‘ ve created following class, and function

 class Tile
        {
            private int north;
            private int east;
            private int south;
            private int west;
        }

        bool checkFit(Tile t, Tile[] R, int pos)
        {
            if (pos == 0)
                return true;

            return false;
            }
    }

In checkfit I will check if i can put puzzle as next element of my array. It gets tile that i try to put, array filled with tiles up to current position that I want to fill, and first empty position (the last one won’t be needed as i will check for first null element in array R, it is only skeleton of function now).

Problem is I can’t figure out algorithm to check for n tile if it fits (n-1) tile edge (and which one?) and if there is another tile to check .

  • 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-26T06:28:03+00:00Added an answer on May 26, 2026 at 6:28 am

    Problem is I can’t figure out algorithm to check for n tile if it fits
    (n-1) tile edge (and which one?) and if there is another tile to check
    .

    The reason you are having problems comming up with your a solution is your prototype will not solve the problem.

    You need to keep track of the row and column of a tile that is all. I assume the variables are the adjcent tiles correct?

    So tile 07 would be adjcent to 06 16 08 and 10 correct?

    If that is the case then the algorithm is extremely easy. You need a jagged array for one thing.

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

Sidebar

Related Questions

I am writing a class to implement an algorithm. This algorithm has three levels
I'm writing an isometric game, but unfortunately I've got stuck writing with the algorithm
I'm writing an algorithm in PHP to solve a given Sudoku puzzle. I've set
I have been writing this encryption algorithm in my free time for a few
I'm not looking to copy a qsort algorithm. I'm practicing writing qsort and this
I have been writing a JS algorithm. Its blazing fast in chrome and dog
I'm writing an algorithm that iterates over a list of points, calculates the distance
I am writing an algorithm to count the number of bars have passed since
I'm writing a search algorithm in C++, and one of the things I need
Lets say I am writing Dijkstra's Algorithm , and I have a priority queue

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.