Skip to content

Instantly share code, notes, and snippets.

@sdebaun
sdebaun / serverless.yml
Created March 26, 2019 18:01
epic serverless.yml
service: ${env:SERVICE, "app-back"}
frameworkVersion: ">=1.21.0 <2.0.0"
provider:
name: aws
runtime: nodejs8.10
stage: ${self:custom.target}
region: ${self:custom.region}
versionFunctions: false

deployment environments

There are two environments that we deploy to that have different combinations of code and backing data.

In general, anything committed to any of the three existing release/* branches will trigger an automatic deployment via Azure.

Once you commit, watch the #pm-dev-notify channel for automatic notifications from azure that your committed code has been deployed. Look for a message that says TODO: Which message confirms the deployment? Is there something cheap and cheerful we can do like, "put your slack name in your commit message to get pinged when deployment is complete?"

TODO: these links are to the admin login which is used for impersonation, should also include link to regular login

using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class MoveTypeTargets {
public HashSet<HexTile> walk = new HashSet<HexTile>();
public HashSet<HexTile> run = new HashSet<HexTile>();
public HashSet<HexTile> jump = new HashSet<HexTile>();
// if you treat these as immutable data objects theres also this sexy:
/*
# GetRunMovesForReserveUnit(playerId, Unit, isVanguard)
What is using it:
- GetHexesForVanguard(Unit)
-- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, true)
- GetActionableHexesForReserveUnit(PTD, Unit, HS<HT> x3)
-- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, false)

I focused on these methods that you changed with an eye towards how those refactorings expose other opportunities. I surveyed both their callers and their callees

GetRunMovesForReserveUnit(playerId, Unit, isVanguard)

What is calling it:

  • GetHexesForVanguard(Unit) -- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, true)
  • GetActionableHexesForReserveUnit(PTD, Unit, HS x3) -- GetRunMovesForReserveUnit(unit.owningPlayerId, unit, false)

Patterns

So because of the refactoring that you started, it's starting to expose patterns in both those functions and related functions.

I am an asshole and using List<Hex> as a stand in for HashSet<HexTile> because my fingers are lazy

One thing i noticed: A lot of the stuff in this reserves behavior looks like:

(List<Hex> starts) => List<Hex> dests