Skip to content

Instantly share code, notes, and snippets.

// Solution to CodeCombat's Gridmancer level
// http://sett.com/codecombat/beat-this-level-get-a-programming-job
// Fill the empty space with the minimum number of rectangles.
// (Rectangles should not overlap each other or walls.)
// The grid size is 1 meter, but the smallest wall/floor tile is 4 meters.
// If you can do better than one rectangle for every tile, let us know!
// We'll help you find a programming job (if you want one).
// Check the blue guide button at the top for more info.
// Press Contact below to report success if you want a job!
@TheSecretSquad
TheSecretSquad / Frame.cs
Last active August 29, 2015 14:00
Bowling Score Calculator Kata from Daedtech.com Alternative Design Question - http://www.daedtech.com/tdd-for-breaking-problems-apart-3-finishing-up
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
public class Frame
{
public static Frame Strike { get { return new Frame(10, 0); } }
@TheSecretSquad
TheSecretSquad / Frames.cs
Created May 2, 2014 23:39
Bowling Score Calculator Kata from Daedtech.com Alternative Design Question - http://www.daedtech.com/tdd-for-breaking-problems-apart-3-finishing-up
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
public class Frames
{
private readonly Frame[] _frames = new Frame[10];
@TheSecretSquad
TheSecretSquad / BowlingScoreCalculator.cs
Created May 2, 2014 23:40
Bowling Score Calculator Kata from Daedtech.com Alternative Design Question - http://www.daedtech.com/tdd-for-breaking-problems-apart-3-finishing-up
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
public class BowlingScoreCalculator
{
private Frames _frames = new Frames();
@TheSecretSquad
TheSecretSquad / BowlingTest.cs
Created May 2, 2014 23:42
Bowling Score Calculator Kata from Daedtech.com Alternative Design Question - http://www.daedtech.com/tdd-for-breaking-problems-apart-3-finishing-up
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ScratchPadTest
{
[TestClass]
public class BowlingTest
{
#include <iostream>
using namespace std;
int main ()
{
unsigned long previousNthFibNumber = 0,
nthFibNumber = 1,
sum = 0,
numEntered;
public interface MovesReceiver {
PathBuilder path(final MoveCount moveCount);
StepBuilder step();
}
public class MoveCount {
private final int number;
public interface MovesReceiver {
void path(final MoveCount moveCount,
final Consumer<PathDirection> pathDirectionConsumer,
final Consumer<CollisionRule> collisionRuleConsumer);
void step(final Consumer<StepDirection> stepDirectionConsumer,
final Consumer<CollisionRule> collisionRuleConsumer);
}
// Original implementation
public class ConsoleCommandSource implements CommandSource {
private final Console console;
private final TextParser textParser;
public ConsoleCommandSource(final Console console, final TextParser textParser) {
this.textParser = textParser;
this.console = console;
}
// Does it matter?
// Testing turnRight() this way tests the behavior in terms of
// another method on the same object.
// Possible problems:
// - We need to implement the other method first.
// - We need to call another method in order to verify that turnRight behaves correctly.
@Test
public void WhenTurningRight_IfPlaced_ShouldMoveInDirectionRightOfStartWhenMoved() {