Git Product home page Git Product logo

f2's Introduction

This project came out of an attempt to spoil a friend's habit of playing a certain unnamed game ("f2"). It is a single-player paper-and-pencil game where you have to cross out numbers that are either equal or sum up to ten. (see RULES.txt) This project serves as (1) an interface to play the game and (2) an attempt to find solutions to it. The files are roughly one year old by now, so this documentation may be sketchy or inaccurate.

-------------------------- THE GAME (F2.PY) --------------------------

The f2.py file is the main program for playing the game yourself. You have the following input options:

  • 'x y dir' --- select a point with the coordinates (x, y) and a neighbour to cross out (see RULES.txt) --- dir can either be ['u', 'l', 'd', 'r'] for each cardinal direction respectively
  • 'c' --- copies field (see RULES.txt)
  • 'exit' --- exits program You should try playing it yourself first before reading on. An example of starting moves would be "0 0 d" then "1 2 u" then "8 0 r" then "7 0 r" then "c" since you are out of moves.

--------------- SOLVING THE GAME (FYEAH.PY; FYEAH2.PY) ---------------

The fyeah and tree-related series of files were created in an attempt to find a solution (1) by looking for a solution through random moves [fyeah.py], which worked in the end and (2) by searching all possible moves in the tree [fyeah2.py]. In the end, the [fyeah.py] found a solution within its scope during its first run. This is remarkable since there are less than 100 trials per run. This hints at lots of possible winning paths. Both programs can be accelerated by commenting out all of the print statements.

fyeah.py:

[fyeah.py] tries a random move and copies the field over with a probability of 1 in 10'000. It could be improved by adapting the probability to the size of the field (greater field -- smaller chance). It could also be improved by ignoring already crossed-out fields for the (x, y)-pick. [fyeah.py] currently outputs to Solution1.txt. The solution that was found is in SOLUTION.txt. Uses [f2_file_loader.py] (misnomer?) to get all possible moves,

fyeah2.py:

[fyeah2.py] builds a tree of possible moves depth-first and then checks whether the game has been won. It's looks mostly abandoned but the cause of a great deal of files in here: [f1.py], [f2_tree_data.py], [f2_tree_handler.py], [f2_file_loader.py] [this.txt], [to_load.txt], [treetesttt.txt], [treetesttttttttttt.txt]

There is also some unused code for queues: [mylist.py], [game_one.py] And the individual squares: [mysquare.py]

------------------------------ LICENSE ------------------------------

What? Licensing/Copyright? Yeah I'd be happy if you fork and improve upon this program! I don't really want to wade through licensing for this little thing, so just point to this paragraph/file if you have the need to.

f2's People

Contributors

xjcl avatar

Watchers

James Cloos avatar  avatar

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.