5 ms·
Warriorjs – An exciting game of programming and artificial intelligence
- ibdf 8y agoPerfect! A game that I can play at work while not working but looking like i'm working. Rename warrior to latest project name and boom, I code all day. But in all seriousness, the floor map idea is pretty neat.
- duxup 8y agoJust be sure it doesn't leak into work code. "Dude about what you pushed yesterday.... what is this swordOfDestiny function you keep using on customer records?"
- camdenreslink 8y agoReally cool project idea. The post submission title seems kind of click-baity though.
- ghostbrainalpha 8y agoThere is also a Ruby Warrior project if someone want to do this in Ruby. https://github.com/ryanb/ruby-warrior https://github.com/ryanb/ruby-warrior
- guessmyname 8y agoIndeed! This is how I learned Ruby several years ago, fun project.
- aeorgnoieang 8y agoAt the bottom of the project's README: > 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.
- danielvinson 8y agoLooks really fun, but is there any way I can play online without having to set up a whole environment for this?
- olistic 8y agoThanks, and good you ask. The online version is in the works, going to be available soon at warriorjs.com. Follow @warrior_js on Twitter to be notified about the release.
- chrisweekly 8y agoIf you're reluctant to install a global package just to try this, any recent Node includes npm5+, which in turn comes with `npx`, enabling: `npx @warriorjs/cli`
- danielvinson 8y agoWhile I doubt this applies to others, my issue here is that my primary work computer is running Windows.
- Zyst 8y agoI just ran this on windows, what's the problem you had with it?
- danielvinson 8y agoIts more of a large inconvenience - I don't develop on my computer, I write all code on servers in my company's cloud. My choice would be to either clone this onto company hardware in the cloud or install node and the associated tools on my desktop.
- pdav 8y agoIs there a particular reason that playing this game on your employer's hardware (and, presumably, on your employer's time) is better than installing it on your computer and playing it at home?
- hiimshort 8y agoI stumbled across this yesterday and had a great time implementing all sorts of interactions for my character. If you're the kind of person who enjoys puzzles or problem solving, this is definitely the game for you.
- mLuby 8y agoWould be fun if there were code-golf scoring: Player.playTurn.toString().length ️
- olistic 8y agoInteresting idea that I'll definitely keep in mind for the online version. Thanks!
- dpcx 8y agoThis is somewhat similar to Screeps (https://screeps.com/ https://screeps.com/) - RTS MMO that you code in Javascript.
- mfoy_ 8y agoWhat a great game. I really should get back into it...
- passivepinetree 8y agoIt would be awesome if there was a way to gain information about your enemies. For example, sometimes (when facing a sludge), it's better to run away, heal, and come back to finish it off at full health. When facing an archer, it's often better to power through and kill it before healing. There's no programmatic way to know which enemy is attacking your warrior, so I'm often finding myself writing custom, non-reusable code for a specific level, which isn't great.
- aeorgnoieang 8y agoCan't you infer what enemy you're facing based on the damage they do to you? In the original, [ruby-warrior](https://github.com/ryanb/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).
- crooked-v 8y agoSomething for basic enemy assessment would allow for more tactical action, though. For example, checking armor and weapon types to switch between your own equipment (hammers vs heavy armor, swords vs cloth armor, spears vs spearmen or beasts with tough hides) - or putting together different signs to decide if an unarmored enemy is a wizard or a thief.
- passivepinetree 8y agoThis is a really good idea that somehow I totally missed. I stopped playing at a level where this became important (as @elefantastisch noted above), but now I kind of want to pick it back up again. It's not guaranteed to work (different enemies might deal the same amounts of damage), but maybe location could help in those cases (i.e., if my warrior is being dealt a certain amount of damage and the space in front and behind the warrior is empty, one could infer the enemy is an archer).
- mfoy_ 8y ago
- piqalq 8y agoI’ve wondered, why are these types of games, such as Screeps or WarriorJS only ever made to be played with JS. Why not Python or Go or Assembly?
- setr 8y agohttps://en.wikipedia.org/wiki/Core_War https://en.wikipedia.org/wiki/Core_War 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
- kroltan 8y agoThere are many polyglot "code games". Off the top of my head: http://codingame.com/ 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/ 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.
- pkkm 8y ago> I also remember an old Java application where you would write AIs for dueling bots, but I don't recall the name. Sounds like Robocode.
- brute 8y agoYou are probably thinking of http://robocode.sourceforge.net/ http://robocode.sourceforge.net/ I played this like 17 years ago and to my most pleasant surprise, the project is still alive.
- aeorgnoieang 8y agoThis one's based on [ruby-warrior](https://github.com/ryanb/ruby-warrior https://github.com/ryanb/ruby-warrior). I'm sure there are other ports for other languages too. I'm pretty sure there's a Python one for one.
- 8y ago
- partycoder 8y agoShould have "Show HN" in the title in my opinion.
- aeorgnoieang 8y agoWhy's that? Was this submitted by the author or a contributor? I couldn't find anything about when "Show HN" is expected in submission titles. What're the rules or conventions?
- ghrifter 8y agoAccount is less than a day old and also see: https://news.ycombinator.com/item?id=17049421 https://news.ycombinator.com/item?id=17049421
- partycoder 8y agoIt was apparently submitted by the author.
- antileet 8y agoSimilar JavaScript programming game running in the browser - http://jswarrior.fusioncharts.com/ http://jswarrior.fusioncharts.com/ Me and a friend built this in 2013, built on top of ideas from the original ruby-warrior.
- DDR0 8y ago`console.log()` does nothing. `debugger` does nothing. How am I supposed to figure out why 'this.isTakingDamage' function isn't working? Just look at it real hard? 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.)
- olistic 8y agoHello DDR0. You're right, you're not a deity, you're a person. Same as people on the other side of the project, who can't just write a perfect game the first time around. 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 https://github.com/olistic/warriorjs/issues/69
- crooked-v 8y agoThis is interesting. Though, for my part, rather than... 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.
- lucideer 8y agoIn this particular example, I don't see why. Player and Warrior are conceptually different entities: one is the player of the game, having properties and methods related to controlling gameplay (e.g. a player might play as alternate warriors at different times), the latter is the avatar, having properties and methods related to that fictional characters attributes within the world of the game. 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)
- deleted 8y ago[deleted]
- DEinspanjer 8y agoDid anyone else have an issue where when installing and running warriorjs for the first time, the player.js file doesn't have any template code in it?
- olistic 8y agoI found this to be an issue with Node 10, did you happen to be running that version? It was already fixed and a new version will be released soon (meanwhile you should be able to play with Node 8).
- DEinspanjer 8y agoYep, I'm running Node v10.1.0 I worked around it by just copying the class as described in the website.
- NVRM 8y agonpm ERR! Please try running this command again as root/Administrator. -> So, it is for god players already...