A better and friendlier optimizer for Puzzle & Dragons.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 90 commits ahead, 11 commits behind chocolatemelt:gh-pages.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
dist
fonts/bootstrap
img
js
tasks
.eslintrc
.gitignore
CNAME
LICENSE
README.md
favicon.png
gulpfile.js
index.html
package.json
screenshot1.png
screenshot2.png

README.md

padopt - a Puzzle & Dragons Optimizer

Screenshot Screenshot

padopt is a Javascript-based web application that finds optimal paths in the mobile game Puzzle & Dragons.

Originally forked from kennytm's pndopt and based on combo.tips. 90% of the credit goes to the aforementioned, including the main Javascript logic.

This fork redesign a whole new responsive UI with friendly mobile support. Single page app support all grid size (so you can keep your profile when switching between 6x5 and 7x6). Rewrite most of the JavaScript to make the code clean. A new client side image analysis JavaScript that let you import from screenshot, without uploading the image to server.

Usage

  1. Select a profile, or create your own profile, to get better solutions.
  2. Input your board, by
  • left or right click on an orb to select its type;
  • click on the top green bar to pick a screenshot from your mobile or desktop file system;
  • drag-and-drop a screenshot from desktop into the browser window;
  • use "Import" feature to manually input all orbs using keyboard;
  1. Click "Solve" after completing the board.
  2. Choose one solution and see how it is performed.

I recommend using this tool to check solutions and for learning purposes; it rarely if ever gives a truly optimal board solution and does not take into account unprotected cascades, orb movement timer, complexity of the path, and other details. That being said, do what you like with it. ¯\(ツ)

Profiles and Calculations

All these do is change the weights of specific orb combinations to change the multiplier value of given solutions. Despite Rows being one of the possible inputs it does a pretty awful job of doing it. I wouldn't recommend using this tool for Row teams (and honestly you shouldn't need to given that they're almost never combo reliant).

For each main attribute add 1 to that color under 'N.' You can optionally add .3 to the columns for sub attributes but it won't change your results much. For color combo leads such as Kali, just put 1 for required colors and 0 for everything else.

For TPA calculations, each TPA on the monster is an additional 1.5 multiplier:

tpa = 1*(1.5)^n - 1

Add the resulting weights for each color.

For example, if you have 3 green monsters and one has a TPA and the other has two TPA, the base weight is 3 and the TPA effect is 1 x 1.5 for the single TPA (.5 extra) and 1 x 1.5 x 1.5 = 2.25 (1.25 extra) for the double TPA so you enter 1.75.

Alternatively just put 1 where you have TPAs and 0 where you don't.

New Predefined Profile

Profiles are now define in profile.js. Feel free to add new profile and send me a pull request. You can also create your own customized profile and save in browser (localStorage).

Requirements

Browsers with following supported:

  • localStorage
  • canvas
  • filereader
  • dataURI
  • requestAnimationFrame
  • cssfilters

Don't worry, modernizr JavaScript does check your browser. If something is not supported, an error page will be displayed.

Development

Run gulp to start a development server at port 8080. The only SCSS file (source.scss) will compile to CSS on-the-fly. Both JS and CSS are auto minify. Everything is config under gulpfile.js.

JavaScript Structure

This project has the follow JavaScript files:

  • source.js: The main JS, which interact with all other JS files and DOM. No other JS files will interact with DOM or each others!!!
  • board.js: The game boards, solution path, and path animation.
  • image-analysis.js: Analysis screenshot for orbs.
  • optimizer2.js: Calculate solutions. Rewrite base on optimizer.js, Remove (almost) all global variables and wrap it into a function (as Class). Remove code that interact with DOM and board. Rename all functions and variables name. Multiple logic is rewrote completely. Other logic is same as the old optimizer.js.
  • profile.js: Store pre-defined profiles, and load/save customized profile from/to localStorage.

3rd party:

  • polyfill.js: JS es6 polyfill for old browser.
  • modernizr.js: Browser features detection.

TODO

  • Introduce better solver (e.g. this post). Currently just a brute-force greedy algorithm, which may not produce truly optimal results.
  • Resolve overlapping lines and points.
  • Simulate swapping and matching when playing the animation and dropping the matches.
  • The default weight of the profiles may need to be adjusted.
  • Image analysis: enhance orb shape analysis
  • Profile add support for different leaders (Leader and Friend using different monster).