Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Python 3 division: Import `division` from `__future__` | nfnty | 2017-01-21 | 1 | -1/+1 |
| | |||||
* | linting: Fix Travis CI | nfnty | 2017-01-17 | 1 | -2/+2 |
| | |||||
* | linting: Python 2 compat: Import from `__future__` | nfnty | 2017-01-17 | 1 | -0/+2 |
| | |||||
* | linting: pylint and flake8 | nfnty | 2017-01-17 | 1 | -8/+10 |
| | |||||
* | linting: autopep8 | nfnty | 2017-01-17 | 1 | -2/+6 |
| | |||||
* | Remove reduntant backslash between brackets. | stepshal | 2016-06-19 | 1 | -1/+1 |
| | |||||
* | Add two blank lines where is expected | stepshal | 2016-06-16 | 1 | -0/+1 |
| | |||||
* | Revert "Use setuptools if present" | hut | 2016-01-25 | 1 | -7/+2 |
| | | | | | | | | | This reverts commit 8b958c577a7f5f484db42b7c26b0340e14fd9351. Reasons: 1. it breaks the `. ranger` command (fixes #454) 2. the `ranger.desktop` file is not installed properly 3. ranger won't run when installing it outside of PYTHONPATH | ||||
* | added ranger.desktop file, fixes #346 | hut | 2016-01-25 | 1 | -0/+2 |
| | |||||
* | setup.py: fix CHANGELOG.md reference | hut | 2015-07-16 | 1 | -1/+1 |
| | |||||
* | Use setuptools if present | Shadab Zafar | 2015-06-25 | 1 | -2/+7 |
| | | | | | | | | | | | | | The main reason for this is the presence of `develop` command in setuptools. So by running `sudo python setup.py develop` - ranger gets installed, but you can easily make changes to the code and won't have to reinstall it. You can read more about it here: http://pythonhosted.org//setuptools/setuptools.html#development-mode It basically links an egg, so I had to add an appropriate line to .gitignore as well. | ||||
* | moved "doc/examples" to "examples" for more visibility | hut | 2015-04-13 | 1 | -1/+1 |
| | |||||
* | Neater copyright header | hut | 2015-03-19 | 1 | -2/+2 |
| | |||||
* | Fixed references to doc/HACKING (for real) | Dorien Snake | 2014-12-10 | 1 | -1/+1 |
| | |||||
* | Fixed references to doc/HACKING | Dorien Snake | 2014-12-10 | 1 | -1/ http://arclanguage.org/item?id=19743 # run with tracing turned on: # ./mu --trace nqueens.mu container square [ rank:num file:num ] def nqueens n:num, queens:&:list:square -> result:num, queens:&:list:square [ local-scope load-inputs # if 'queens' is already long enough, print it and return added-so-far:num <- length queens { done?:bool <- greater-or-equal added-so-far, n break-unless done? stash queens return 1 } # still work to do next-rank:num <- copy 0 { break-unless queens first:square <- first queens existing-rank:num <- get first, rank:offset next-rank <- add existing-rank, 1 } result <- copy 0 next-file:num <- copy 0 { done?:bool <- greater-or-equal next-file, n break-if done? curr:square <- merge next-rank, next-file { curr-conflicts?:bool <- conflict? curr, queens break-if curr-conflicts? new-queens:&:list:square <- push curr, queens sub-result:num <- nqueens n, new-queens result <- add result, sub-result } next-file <- add next-file, 1 loop } ] # check if putting a queen on 'curr' conflicts with any of the existing # queens # assumes that 'curr' is on a non-conflicting rank, and checks for conflict # only in files and diagonals def conflict? curr:square, queens:&:list:square -> result:bool [ local-scope load-inputs result <- conflicting-file? curr, queens return-if result result <- conflicting-diagonal? curr, queens ] def conflicting-file? curr:square, queens:&:list:square -> result:bool [ local-scope load-inputs curr-file:num <- get curr, file:offset { break-unless queens q:square <- first queens qfile:num <- get q, file:offset file-match?:bool <- equal curr-file, qfile return-if file-match?, true/conflict-found queens <- rest queens loop } return false/no-conflict-found ] def conflicting-diagonal? curr:square, queens:&:list:square -> result:bool [ local-scope load-inputs curr-rank:num <- get curr, rank:offset curr-file:num <- get curr, file:offset { break-unless queens q:square <- first queens qrank:num <- get q, rank:offset qfile:num <- get q, file:offset rank-delta:num <- subtract qrank, curr-rank file-delta:num <- subtract qfile, curr-file rank-delta <- abs rank-delta file-delta <- abs file-delta diagonal-match?:bool <- equal rank-delta, file-delta return-if diagonal-match?, true/conflict-found queens <- rest queens loop } return false/no-conflict-found ] def main [ nqueens 4 $dump-trace [app] ] |