Giter Club home page Giter Club logo

hrm-solutions's Introduction

Build and Deploy

Human Resource Machine solutions

This repo contains working solutions, in hopes of exchanging ideas to collaboratively come up with the most/size.speed optimized solutions (or simply to help those out there who are stuck). Even though the programs are created through a drag-and-drop interface within the game, copy/paste from/to the clipboard works as assembly source code seen in this repo.

Top Scores and more info.

File Naming Convention

The file naming convention used is:

Under the solutions folder, inside a subfolder called <level>-<level name>-<size par>.<speed par>, <size>.<speed>[.<type>]-<author>.asm

Where size and speed are the number of commands and steps of the solution, which is deemed by the game as size and speed optimized if they are equal to or less than the par numbers in its folder's name.

The optional type field is a descriptor for the type of solution (e.g. the algorithm used, whether it's an exploit etc.)

author is the GitHub username of the author of the solution.

For example, solutions/07-Zero-Exterminator-4.23/4.23-atesgoral.asm means the solution is both size and speed optimized and is by user atesgoral.

Contributing

Please issue a pull request while keeping in mind:

  • The file naming convention is met
  • If you're a new contributor, edit the contributors.yml file to add yourself
  • Make sure your new solution passes tests (see below)

Testing

You need Node.js 18+ and Yarn to be installed.

yarn to install all dependencies

yarn test to run tests.

Tools Used

The tests involve the static/runtime analysis and benchmarking of each solution by utilizing:

hrm-solutions's People

Contributors

18111398 avatar 837951602 avatar aaronknowles avatar alandesmet avatar atesgoral avatar caitsith2 avatar clarfonthey avatar cowboy avatar dependabot[bot] avatar eirik0 avatar eittio avatar ekx avatar gimlao avatar halchihal avatar jdashton avatar lezardi avatar mschordan avatar mygod avatar nanashi-juanto avatar otto42 avatar patrick-jakubowski avatar peterfreese avatar popq avatar skwasjer avatar sniperrifle2004 avatar sutch avatar unframework avatar viamodulo avatar vvolhejn avatar wolfwings avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hrm-solutions's Issues

Hosting "normal" solutions

This repo started off with standard solutions I came up with for all levels, without necessarily meeting or exceeding the size and speed challenges. I set it as a goal to make this into a collaborative space to push the boundaries of size/speed optimizations, and it has been going really well so far :) But, I'm also a little bothered by the fact that there's no longer any room for any "normal" solutions that could help people with learning about algorithms and get unstuck in the game.

I can think of 2 options:

Option A:
Continue with hosting just size/speed optimizations.

Option B:
Find a naming convention / folder structure to also host several "normal" solutions (like both a bubble sort and a selection sort alternative to 41 Sorting Floor)

Any suggestions?

Rebase and merge pre-push

@nanashi-juanto I'm rebasing and merging this branch in to prevent further divergence from master. Let me know if you had any additional commits that weren't yet pushed -- we can still rebase and get those in later.

Question: interest in unusual solutions, even if not a record?

I was wondering: is there any desire for the addition of fun/strange/interesting/unusual solutions to puzzles, even if they aren't a record for either size or speed? (I ask, since my solution to Duplicate Removal uses a hash-table based algorithm that is quite different from the solutions already listed. I think it might be of interest to others even though it's not as good!)

24

Here is a 11 commands & 53 steps for lvl 24 by myself (@drallieiv)

-- HUMAN RESOURCE MACHINE PROGRAM --

a:
    INBOX   
    COPYTO   0
    INBOX   
    COPYTO   1
    COPYFROM 0
b:
    SUB      1
    JUMPN    c
    JUMP     b
c:
    ADD      1
    OUTBOX  
    JUMP     a


DEFINE LABEL 0
eJzjYWBgmKDjfr7Y/OSiV1ZaPQl2W1IjHFOjzrvMDvZ1rcoUdj53GaiE4ZM5y/yVQe4LGUbBKBgFwwoA
AHzKEfk;

DEFINE LABEL 1
eJyTY2BgOKEvGwqkGI4aJGie0psf5qM3v4XdwHtJs+H8TSDxNoMUnUW2j7SEnVN0Wj1yjf55fTb75tvk
uMWPw+2zX4jfFr+IwD3e88MMLV7HLbXZkirmxFJ40m16HZuHYhtQfd8Rj70z2TwY5kQ4nlxUZ8y71FM/
YDnDKBgFo2BQAADScywL;

DEFINE LABEL 3
eJwTZGBgWGvp7vre4nHbG8tLK4BchhXWsqGSjtf8rzhJBvW7PIo46VaX0+XWXxHgIloLFK9dYd1VmmE9
uTrB7nWPh/u5pQyjYBSMgiELAByyG2I;

Simulator is sorting numbers as strings

The simulator is incorrectly showing sort solutions as failing, because it is sorting 10 before 2:

input:
[ 7, 10, 6, 6, 5, 7, 6, 2, 4, 0, 'M', 'K', 'R', 'W', 0, 3, 2, 5, 5, 10, 3, 6, 5, 7, 8, 0 ]
expected:
[ 10, 2, 4, 5, 6, 6, 6, 7, 7, 'K', 'M', 'R', 'W', 10, 2, 3, 3, 5, 5, 5, 6, 7, 8 ]
actual:
[ 2, 4, 5, 6, 6, 6, 7, 7, 10, 'K', 'M', 'R', 'W', 2, 3, 3, 5, 5, 5, 6, 7, 8, 10 ]

One solution is to remove 10 from the test pool. Another is to fix the problem.

gh-pages

Could have better looks than the README.md, and could allow dynamic features like pulling in level info from hrm-level-data, and even the ability run programs right inside the browser.

Look into recovering overwritten solutions

Prior to the naming convention of including the author in the filename, we had been accepting PRs that simply overwrote existing solutions. It could be very tedious task, but it would be nice to recover old solutions (especially the "normal" ones).

19. Countdown Speed

(Wasn't sure how to submit but this gets the speed completed)

-- HUMAN RESOURCE MACHINE PROGRAM --

a:
b:
    INBOX   
    JUMPN    c
    JUMP     e

c:
    COPYTO   0

d:
    OUTBOX  
    BUMPUP   0
    JUMPN    d
    JUMPZ    g

e:
    COPYTO   5

f:
    OUTBOX  
    BUMPDN   5
    JUMPN    b
    JUMP     f

g:
    OUTBOX  
    JUMP     a

Program runner

Utilizes either hrm-cpu or hrmsandbox to run a program against a level.

84 step solution to 20-Multiplication Workshop

I have an 84 step solution to 20-Multiplication Workshop. I'd like to submit it, but when I try to create a PR using GitHub desktop, I get:

Sync failed to push local changes
It seems you do not have permission to push your changes to this repository.

I'm new to github, and I'm probably doing something incorrectly. I've cloned the repo, created a branch, and commited my local changes to the branch. Should I be able to create a PR at this step?

24-Mod-Module.size.speed.asm

I am new to github and am very confused. I'm still trying to figure out how to do everything.

This does it in 11 commands and 53 steps.

-- HUMAN RESOURCE MACHINE PROGRAM --

a:
INBOX
COPYTO 0
INBOX
COPYTO 1
COPYFROM 0
b:
SUB 1
JUMPN c
JUMP b
c:
ADD 1
OUTBOX
JUMP a

Programatically check solutions

Hi - I'm really not sure that an issue is the best way to communicate this, but just wanted to say that if you want to programatically check the solutions, I made a runtime that executes HRM asm files in javascript:

https://github.com/nrkn/hrm-cpu

See the test folder to see how you would batch check multiple solutions - I'm currently testing against my own (admittedly feeble) solutions

Requires node >=4.12

Registry of solutions so other projects can programatically access solutions

A registry would be nice, either via a JSON file (maintained per PR) or an index.js which could return the solutions for some level n. This would let me wire up hrm-level-data, hrm-level-inbox-generator, hrm-level-outbox-generator, and hrm-solutions as a set to feed my sandbox (or any other emulator, really).

Pseudocode:

var levels = require('hrm-level-data');
var inboxer = require('hrm-level-inbox-generator');
var outboxer = require('hrm-level-outbox-generator');
var solutions = require('hrm-solutions');

levels.forEach(function (level) {
  var inbox = inboxer.generate(level.number);
  var outbox = outboxer.generate(level.number, inbox);
  if (inbox === null || outbox === null) {
    inbox = level.examples[0].inbox.splice();
    outbox = level.examples[0].outbox.splice();
  }

  // the Solution Registry tie-in here
  solutions.getSolutions(level.number, function (solution) {
     // execute `solution`
     var results = hrm.execute(solution, { inbox: inbox, variables: level.floor.tiles.splice() });
     if (!testOutboxes(results.outbox, outbox)) {
        // bad
     }
  });
});

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.