Skip to content

Instantly share code, notes, and snippets.

interface IAuditor
{
void RecordThatSomethingWasDone();
}
class Service
{
private readonly IAuditor _defaultAuditor = new StandardAuditor();
public void DoSomething(IAuditor auditor = null)
@jdunne
jdunne / trouble-strategy.markdown
Last active July 9, 2021 20:54
How to win at Trouble.

The winning strategy in Trouble is to maximize the number of pieces that you have in play, while minimizing your opponents' pieces and limiting the exposure of your own pieces to attack.

I think this is the best possible way to accomplish that:

  • If you rolled a 6:
    • If you still have a piece in the home area:
      • Move that piece into the start position.
    • Else if you have a piece in the start position:
  • Move it out of the start position.
@jdunne
jdunne / Makefile
Created August 3, 2012 22:04
Makefile for running a command on a bunch input files (*.txt)
.PHONY: clean all
%.out : %.txt
# Substitute real command for cat.
cat $?
touch $@
all : $(patsubst %.txt,%.out,$(wildcard *.txt))
clean: