Skip to content
forked from lmmx/netwalk

Solver for netwalk, reading in image files of game state [under development]

Notifications You must be signed in to change notification settings

jeffest/netwalk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netwalk

Solver for netwalk, reading in image files of game state,

Status - TBC

  • Game currently unsolvable at the expert level
  • Having exhausted all guidance in the tutorial, I'm open to adding new solver logic if I get suggestions or bright ideas
  • Having tried to solve the partly solved game state (see data/lgo_netwalk_example_game_expert_part_solved.png) the only route I can see is to see whether taking arbitrary decisions sets off a 'chain reaction' of tile solving (as is ensured to happen at easy and intermediate difficulty levels).
  • Having attempted this manually, I've noted that when setting fix_connection(a), it's crucial to supply as many possible values to the a direction vector as there are connections possible on a tile (e.g. freezing the 0,0 [corner wire] tile in the above example using a=[0,3] will initiate a chain reaction whereas simply a=[0] or a=[3] will lead to errors, as it effectively puts the game 'out of sync').
  • It's not immediately clear however whether this approach will lead to full solutions - however I suspect trying it with the tiles with the maximum number of connections (i.e. the T-wires) bordering an already solved region will be most likely to produce a full solution state...
  • This however is dependent on already having a solved region from the initial solve step, which appears to be the minority of generated game states at expert level!

Development progress

  • Solver now works for the easier game format, where there are blank tiles on the grid periphery
  • Solver now works for the medium game format (for the one game I tried, uncertain if it will solve all)
  • Solver for the expert level is under development...
  • Solver can now display the results by rotating the tiles of the input image

Example game states

Beginner

Initial state 1:

Solved:

Initial state 2:

Solved:

Medium

Initial state:

Solved:

Expert

Initial state 1:

Part solved:

Initial state 2:

Not solved:

About

Schematic of the NetWalk puzzle and its components, from De Biasi (2012) The complexity of the puzzle game Net: rotating wires can drive you crazy

* A couple of exceptions:

  • N.B. the power unit shown in the figure here [from a paper] has two outputs, whereas the one coded for in this library has from one to three, in line with the game at this link

Usage

Interactive

  • python -im netwalk
  • from .imaging import give_me_the_tiles (or show_me_the_solved_tiles to open a viewer)

Command line

  • python -c "from netwalk import imaging; imaging.show_me_the_solved_tiles()"
  • (There's no full [expert level] solving functionality yet but will add a proper CLI interface when there is)

TODO

  • write tests for all components
    • give all wire components on states
      • check this hasn't broken any tests
  • use relative data path rather than hardcoded
  • read in image file and parse tiling/component state
  • detect output directions of component wiring and add to component state
  • write tests for imaging and tiling
  • add to the tile initialisation:
    • a 'solved' property per tile
    • a 'fixed' vector per component output direction
    • an 'avoid' vector per tile [maximum length = 4 - number of output directions]
  • add methods that modify these attributes per tile over the tileset
  • implement an interface list with methods to access both tiles across an interface
  • implement tile level check_solvable, solve, check_solved, set_fixed, and set_avoid methods
  • add a series of solvers for a tile which can be run in succession as applicable
    • just implemented a single class in solve_tile in the end with logical checks
  • add further solvers until the expert level can be solved
  • calculate and display tile rotations
    • apply the rotations to the input image and display a solved form on screen
  • add a command to automatically save a game solution to the data directory based on its input filename

About

Solver for netwalk, reading in image files of game state [under development]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%