Warriorjs – An exciting game of programming and artificial intelligence
github.com
github.com
class Player {
playTurn(warrior) {
warrior.walk();
...
}
}
...I would much rather have something like... import { Warrior } from '@warriorjs/cli';
class MyWarrior extends Warrior {
playTurn() {
this.walk();
...
}
}
...or... function playTurn(warrior) {
warrior.walk();
...
}
The current style is a weird mix of functional and object-oriented handling.The differences in purpose of the two entities aren't really anything to do with fp vs oop; I don't see what's fp-ish about the first example, and your last example is potentially a weird mix of fp and oop (depending on what "warrior" is, and I can't figure out what use it would be in that context if it wasn't an object with encapsulated methods)
In the original, [ruby-warrior](https://github.com/ryanb/ruby-warrior), you can `listen` (at some point) to get an array of occupied spaces and then you can check if a space contains an enemy. If you're not immediately adjacent to an enemy but your warrior is taking damage you can infer you're being attacked by an archer (or another enemy with a ranged attack).
But in all seriousness, the floor map idea is pretty neat.
"Dude about what you pushed yesterday.... what is this swordOfDestiny function you keep using on customer records?"
> This project was born as a port of ruby-warrior. Credits for the original idea go to Ryan Bates.
I was sure of it based on how (almost exactly) similar this was.
I'm not some sort of deity who can just write perfect javascript the first time around.
On a side note, running with `entr -p warriorjs --time 0.4 <<< Player.js` is quite convenient. (Run the warrior through the level on save of file.)
If you're interested in proposing a solution for the issue you describe, there's already people discussing it here: https://github.com/olistic/warriorjs/issues/69
`npx @warriorjs/cli`
Lunch at your desk and "nothing to do if nothing breaks" server-monitoring shifts are both common, and that's just in the tech world.
Probably because if it's going to be in the browser, they have to do a large chunk of the work in JS anyways
and of course, everything is JS these days
Off the top of my head: http://codingame.com/ - They support a lot of languages, even Rust!
I also remember an old Java application where you would write AIs for dueling bots, but I don't recall the name.
The folks at https://codegolf.stackexchange.com/ also host several games like that, more often than not competitively, however, and not open-ended or "singleplayer" games. Most accept any language that can take stdin and print stdout.
Sounds like Robocode.
I played this like 17 years ago and to my most pleasant surprise, the project is still alive.
I'm sure there are other ports for other languages too. I'm pretty sure there's a Python one for one.
If you know python and had never written JS before, you could probably still play this with a bit of trial and error.
Me and a friend built this in 2013, built on top of ideas from the original ruby-warrior.
I worked around it by just copying the class as described in the website.
I couldn't find anything about when "Show HN" is expected in submission titles. What're the rules or conventions?
-> So, it is for god players already...