HNHacker News
TopNewBestAskShowJobs

billnreed

10 karma · joined October 31, 2017

submissionscomments
billnreed··on Boardgame.io: an engine for creating turn-based games using JavaScript
I've seen this engine before and thought it was really cool!

I've been playing around with writing my own turn-based game engine with TypeScript: https://github.com/snowbillr/turn-based-game-engine

It's a WIP still, but what's really been the struggle for me is coming up with a data structure and traversal algorithm for the turn order. I wanted that to be extremely configurable by whoever uses the library.

```

engine.defineFlow((f) => {

  f.node({
    actions: f.actions(WelcomeMessage),
  })

  f.node(
    {
      actions: f.actions(RoundStart),
      cleanups: f.cleanups(RoundEnd, TestLog),
    },
    players.map(player => f.node({
      playerId: player.id,
      actions: f.actions(TurnStart),
      cleanups: f.cleanups(TurnEnd),
    })),
  )
});

```

This example shows a TicTacToe game defined like this:

```

- welcome

- round

  - player 1 turn

  - player 2 turn
```

What I ended up with was essentially a tree that's traversed depth-first to enter each node, and then goes back up the same traversal path until a sibling node is found to dive into.

That lets the user define rounds/turns/phases as children of each other in whatever shape they want.

It's been a real fun project!

billnreed··on LoaderShip – CSS-Only Loaders
Thank you! No license or anything, just go for it if you want to use them.
billnreed··on LoaderShip – CSS-Only Loaders
I made a few CSS-only single `div` loaders a while back, it was a fun challenge to make them interesting while only using a single div.

https://codepen.io/snowbillr/pen/QEagmW

billnreed··on How to write a JavaScript-free todo app using just HTML and CSS
That's super cool! The `:checked` and `:valid` and `:invalid` selectors are really powerful tools when it comes to CSS. This is a real fun use of clever CSS selectors.

I was doing something similar the other day with toying around trying to come up with an HTML/CSS only game. I ended up with this: https://codepen.io/billnreed/full/boXrVr