GithubHelp home page GithubHelp logo

jewb's People

Contributors

faddison avatar

Watchers

 avatar  avatar

jewb's Issues

in what order are combos executed?

jewb-state-order

the image illustrates a possible scenario where a race condition could occur. how does bejewelled handle this? will the order affect the future board state?

design click pattern that maximizes the number of tiles that can be clicked while minimizing the effect on surrounding tiles

if two tiles are clicked simultaneously and one of them depends on the second being in the original location to form a combo it will not occur because the second will be in a moving state. See figures below for example.

figure 1
x x x x x x x x
x x x x x x x x
x x x x x x x x
x x x x x x x x
x x x x x x x x
a b x x x x x x
b x x x x x x x
b x x x x x x x

In figure 1 above a combo can be made by swapping tiles (0,5) and (1,5). However, this requires that tiles (0,6) and (0,7) are stationary. the swap animation take between 300-600 ms. This limits how many moves can be made per second. Computationally, a move can be made in less than 1 ms.

In order to maximize the number of legitimate moves that can be made simultaneously (or pseudo simultaneously) all surrounding tiles that could possibly be affected by the swap must be found.

figure 2
x x x x x x x x
x x x o u x x x
x x x o u x x x
x o o a b u u x
x x x o u x x x
x x x o u x x x
x x x x x x x x
x x x x x x x x

Looking at figure 2, assume that a and b were just swapped. o and u show the possible combinations that could be formed from this swap (respectively). In order to minimize interference these areas should be avoided during the next swap. However, there's multiple degrees of interference to consider. First degree interference would mean trying to swap one of the affected tiles which would prevent a combo from being recognized. Second degree interference would be swapping another tile who's combo region intersected with this combo region. As shown below in figure 3.

figure 3
x x x x x x x d
x x x o uv v v c
x x x o u x x v
x o o a b u u v
x x x o u x x x
x x x o u x x x
x x x x x x x x
x x x x x x x x

Assuming c and d were just swapped immediately after a and b. Now one of their possible combo region intersect each other at (4,1) uv. What are the implications of this? One is that if a combo from the a and b swap forms which coincides with the c and d combo formation then we simply end up with a wasted move because the first combo already executed and the replacement tiles haven't been generated yet.

If this is the only consequence then a static click pattern can be successfully generated based on this algorithm. Since we are able to execute moves much quicker than the animation allows them to resolve eventually we will need to wait. But for now it will improve the bots legitimate moves per second significantly.

determine the order of operations of events

relates to the previous issue of race conditions. I believe these issues may eventually resolve themselves due to the sequential nature of the event processing.

for now I must determine the order of operations when shifting columns down.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.