Skip to content

pete-rai/flowfree-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flowfree-player

Visit my Blog to get in touch or to see demos of this and much more.

Overview

This node module automatically plays FlowFree on a connected Android device. It can play any board size, but is limited to rectangular boards and board without obstructions. You can see it in action by watching this video:

https://www.youtube.com/watch?v=g5ZkIrRvxMc

The module is implemented as a demonstration of my node module android-automate which is available as an official node package manager repo:

https://www.npmjs.com/package/android-automate

Using android-automate, you can control any connected Android device using simple, flexible function chains. You will also find demos in there for controlling other apps, such as TikTok and Whatsapp.

The core logic for the game is provided by Matt Zucker's excellent Python solution. This reduces the board to a boolean satisfiability problem, which is then solved using the pycosat solver.

This application uses this Python solver, but wraps around it a way to "read" the board from the screen, feed this to the solver and then to convert the computed solution into a series of on-screen swipes.

License

This project is available under the MIT license. Please respect the terms of the license.

Karmaware

This software is released with the karmaware tag

Disclaimer

I've done best efforts testing on a few devices. If you find any problems, please do let me know by raising an issue here. Better still, create a fix for the problem too and drop in the changes; that way everyone can benefit from it.

Installing

Here are some notes on how you can install flowfree-player and get it running on your own device.

Dependencies

This module has a dependency on node and on python. Both must be installed and operational on your host machine. The python solver has a dependency on the pycosat library and you should install this using the pip infrastructure.

The android-automate module, also has a dependency on the Android Platform Tools. Please refer to the Before You Start section of the android-automate readme to find out how to install the dependencies of that module and how to connect your target device.

Configuration

To configure your local installation, first make a .env file, by coping the .env.example file. Then modify the entries in this file to match your local environment.

Option Description
PYTHON_PATH The path to your python executable.
SCREEN_INFO A JSON structure outlining where the game info is on the screen of your target device.
SCREEN_BOARD A JSON structure outlining where the puzzle board is on the screen of your target device.

You can refer to the diagram below to see which rectangles you must specify in the SCREEN_ options configuration.

Example Screenshot

You can use a module option to take a screenshot of the game onto your local machine to help identify these coordinates (see next section).

Running

To run the application, assuming you have completed all the steps in the dependency section, simply first install the required node modules:

npm install

To run the module, first make sure that your device is running FlowFree and is parked on the puzzle board which you want to solve and that no squares have yet been played. Then start the solver like this:

npm start

You can use the following to generate a local screenshot to help you configure the application, as described in the earlier section:

npm run screenshot

The screenshot will be present in the project folder as screenshot.png.

Have fun!

Pete Rai

About

Automatically plays FlowFree on a connected Android device.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published