This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @startId bigint; | |
DECLARE @endId bigint; | |
SET @startId = 0 | |
SET @endId = 42327636 | |
WHILE (@startId > @endId) | |
BEGIN | |
UPDATE storage.StorageInformation | |
SET LocationTypeId = 0, BackupLocationTypeId = 0 | |
WHERE @startId <= StorageId and StorageId < @startId + 100000 and LocationTypeId IS NULL; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Xna.Framework; | |
namespace DreamersDesign | |
{ | |
public class Camera | |
{ | |
public Camera( int viewportWidth, int viewportHeight, Vector2 cameraPosition, ClockManager clockManager ) | |
{ | |
ViewportWidth = viewportWidth; | |
ViewportHeight = viewportHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyCleverEnum | |
{ | |
public static readonly MyCleverEnum First = new FirstCleverEnum(); | |
public static readonly MyCleverEnum Second = new SecondCleverEnum(); | |
// Can only be called by this type *and nested types* | |
private MyCleverEnum() | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string RandomString(int length, string allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") { | |
if (length < 0) throw new ArgumentOutOfRangeException("length", "length cannot be less than zero."); | |
if (string.IsNullOrEmpty(allowedChars)) throw new ArgumentException("allowedChars may not be empty."); | |
const int byteSize = 0x100; | |
var allowedCharSet = new HashSet<char>(allowedChars).ToArray(); | |
if (byteSize < allowedCharSet.Length) throw new ArgumentException(String.Format("allowedChars may contain no more than {0} characters.", byteSize)); | |
// Guid.NewGuid and System.Random are not particularly random. By using a | |
// cryptographically-secure random number generator, the caller is always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EnumExtensions | |
{ | |
private static void CheckIsEnum<T>(bool withFlags) | |
{ | |
if (!typeof(T).IsEnum) | |
throw new ArgumentException(string.Format("Type '{0}' is not an enum", typeof(T).FullName)); | |
if (withFlags && !Attribute.IsDefined(typeof(T), typeof(FlagsAttribute))) | |
throw new ArgumentException(string.Format("Type '{0}' doesn't have the 'Flags' attribute", typeof(T).FullName)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create new table for keeping track of all the versions of project files | |
CREATE TABLE wa.ProjectVersion( | |
ProjectVersionId int IDENTITY(1,1) NOT NULL, | |
ProjectId int NOT NULL, | |
DateCreated datetime2(7) NOT NULL, | |
ProjectFileId varchar(50) NOT NULL | |
PRIMARY KEY CLUSTERED | |
( | |
ProjectVersionId ASC | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Draw everything that will be transformed with the camera like the player, cells, etc. | |
_spriteBatch.Begin( SpriteSortMode.BackToFront, null, SamplerState.PointClamp, null, null, null, Camera.TranslationMatrix ); | |
for ( int x = minX; x < maxX; x++ ) | |
{ | |
for ( int y = minY; y < maxY; y++ ) | |
{ | |
bool isVisible = Global.GameModel.Map.Properties[x + y * Global.GameModel.Map.Width] == CellProperties.Visible; | |
Tiles[x, y].Draw( _spriteBatch, SpriteSheet, new Vector2( x * Global.CellWidth, y * Global.CellHeight ), isVisible ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Text.RegularExpressions; | |
using System.Xml; | |
using System.Xml.Linq; | |
namespace Formix.Utils | |
{ | |
class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Program | |
{ | |
private static double DistanceBetween( int x1, int y1, int x2, int y2 ) | |
{ | |
return Math.Sqrt( Math.Pow( x2 - x1, 2 ) + Math.Pow( y2 - y1, 2 ) ); | |
} | |
private static int WalkingDistanceBetween( int x1, int y1, int x2, int y2 ) | |
{ | |
return Math.Abs( x2 - x1 ) + Math.Abs( y2 - y1 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let exploreState = { | |
execute: function(player,warrior) { | |
if (player.sense(warrior) === 'empty') { | |
warrior.walk(player.direction); | |
} | |
else if (player.sense(warrior) === 'wall') { | |
warrior.pivot(); | |
} | |
else if (player.sense(warrior) === 'enemy') { | |
warrior.think("It's time to kick ass and chew bubble gum..."); |
OlderNewer