Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott Lilly ScottLilly

View GitHub Profile
@ScottLilly
ScottLilly / Bedroom.cs
Created Nov 4, 2013
Sample of how to start building an RPG, with rooms that have different (and common) actions you can perform in them.
View Bedroom.cs
namespace BusinessObjects.RedditZorkQuestion
{
public class Bedroom : Room, ICanSleepHere
{
public Bedroom(string name) : base(name)
{
}
public void Sleep(Character character)
{
@ScottLilly
ScottLilly / SortedListWithFloorAndCeilingIntegerKey.cs
Created Oct 18, 2013
Specialized SortedList classes to let you search for the entry immediately before, or after, the requested key value.
View SortedListWithFloorAndCeilingIntegerKey.cs
using System;
using System.Collections.Generic;
namespace DotNetToolBox.Collections
{
public class SortedListWithFloorAndCeilingIntegerKey<TV> : SortedList<Int32, TV>
{
#region Floor object methods
public int FloorIndexFor(Int32 searchKey)
@ScottLilly
ScottLilly / DeleteQueryWithGrammar.cs
Created Oct 14, 2013
Source code for my "How to build a fluent interface in C#" blog post.
View DeleteQueryWithGrammar.cs
using System.Collections.Generic;
using BuildAFluentInterface.Interfaces;
namespace BuildAFluentInterface
{
public class DeleteQueryWithGrammar : ICanAddCondition, ICanAddWhereValue, ICanAddWhereOrRun
{
private readonly string _tableName;
private readonly List<WhereCondition> _whereConditions = new List<WhereCondition>();
@ScottLilly
ScottLilly / InventorySystem.cs
Created Oct 11, 2013
C# code for inventory system that has a limited number of slots, and the ability to stack some items (with a different maximum size stack for different items).
View InventorySystem.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace BusinessObjects.RedditRPGQuestion
{
public class InventorySystem
{
private const int MAXIMUM_SPACES_IN_INVENTORY = 10;
You can’t perform that action at this time.