Giter Club home page Giter Club logo

night-watch-planner's Introduction

Night Watch Planner v0.1.0 CircleCI Deploy on Railway

Just a Night watch planner optimizer for use in RPGs like Pathfinder.

Sample request

Sample Plan Request with this body:

{
	"maxTotalTimeSpent": 720,
	"party": [
		{
			"name": "Gandalf",
			"senses": ["Low light"],
			"requiredSleepTime": 480
		},
		{
			"name": "Legolas",
			"senses": ["Low light"],
			"requiredSleepTime": 240
		},
		{
			"name": "Gimli",
			"senses": ["Darkvision"],
			"requiredSleepTime": 480
		},
		{
			"name": "Boromir",
			"senses": ["Normal"],
			"requiredSleepTime": 480
		}
	]
}

curl command to test the endpoin:

curl --request POST \
  --url http://localhost:3000/v1/optimize \
  --header 'content-type: application/json' \
  --data '{
	"maxTotalTimeSpent": 720,
	"party": [
		{
			"name": "Gandalf",
			"senses": ["Low light"],
			"requiredSleepTime": 480
		},
		{
			"name": "Legolas",
			"senses": ["Low light"],
			"requiredSleepTime": 240
		},
		{
			"name": "Gimli",
			"senses": ["Darkvision"],
			"requiredSleepTime": 480
		},
		{
			"name": "Boromir",
			"senses": ["Normal"],
			"requiredSleepTime": 480
		}
	]
}'

Rules

Optimizer follow this rules in order to find the best night watch plan:

  • Hard rules (for a plan to be feasible):
    • Plan has no empty watches.
    • There is no lazy characters.
    • Total time spent should be less than maximum in specified in plan request.
  • Medium rules (very nice to have):
    • No solo watches.
    • No oversleeping time.
  • Soft rules (nice to have):
    • No overloaded watches (more than two characters in the same watch).

night-watch-planner's People

Contributors

carloscasalar avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

night-watch-planner's Issues

Hot reloading not working

With the actual configuration (currently in branch feature/add-web-client), hot reducer reloading is not working. Whenever I do a change while running the development environment, this error are shown in the console:

<Provider> does not support changing `store` on the fly. It is most likely that you see this error 
because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers 
automatically. See https://github.com/reactjs/react-redux/releases/tag/v2.0.0 for the migration 
instructions.

I've read that instructions but they don't help me.

I'll back to this problem further, maybe following this thread and this link.

Solution with bad Sleep time

With this request:

{
	"maxTotalTimeSpent": 720,
	"party": [
		{
			"name": "Cornijal",
			"senses": ["Normal"],
			"requiredSleepTime": 480
		},
		{
			"name": "Nekane",
			"senses": ["Darkvision"],
			"requiredSleepTime": 360
		},
		{
			"name": "Hand'dir",
			"senses": ["Low light"],
			"requiredSleepTime": 240
		},
		{
			"name": "Arogas",
			"senses": ["Darkvision"],
			"requiredSleepTime": 480
		}	]
}

This result should not be feasible because the PC "Hand'dir" does sleep only 60 min:

{
	"watchesSummary": [
		{
			"watchfulCharacters": [
				"Arogas",
				"Hand'dir"
			],
			"sleepingCharacters": [
				"Cornijal",
				"Nekane"
			],
			"length": 180
		},
		{
			"watchfulCharacters": [
				"Hand'dir",
				"Nekane"
			],
			"sleepingCharacters": [
				"Arogas",
				"Cornijal"
			],
			"length": 300
		},
		{
			"watchfulCharacters": [
				"Cornijal",
				"Hand'dir"
			],
			"sleepingCharacters": [
				"Arogas",
				"Nekane"
			],
			"length": 180
		},
		{
			"watchfulCharacters": [
				"Arogas",
				"Cornijal",
				"Nekane"
			],
			"sleepingCharacters": [
				"Hand'dir"
			],
			"length": 60
		}
	],
	"totalTime": 720,
	"score": {
		"initScore": 0,
		"hardScore": 0,
		"mediumScore": 0,
		"softScore": -1,
		"feasible": true,
		"solutionInitialized": true
	}
}

And it is scored -1Soft.

Version 0.0.3

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.