Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
Simple Particle Engine for a shooter game
Snake / Nibbles clone in C and Ncurses
Please improve
Parsing of XML data has high CPU usage
Convert simple Javascript to jQuery plugin
Active Record getting unique records
List the files in a directory without the directory name or the extension
clean the code
ohs system, recruitment software, hr software, oh&s software, human resources software, ohs software
Array parsing in a block
Popular
Parsing of XML data has high CPU usage
Please improve
Snake / Nibbles clone in C and Ncurses
List the files in a directory without the directory name or the extension
Convert simple Javascript to jQuery plugin
Simple Particle Engine for a shooter game
Active Record getting unique records
Breadth first cartesian product iterator
php refactoring
first BST
Pastable version of
Square Class
<pre class='prettyprint' language='cs'>using System; using System.Collections.Generic; using System.Text; namespace NuriProg.Model { public enum SquareType : byte { Wall = 1, Room = 2, Unknown = 4 } public delegate void SquareChanged(Square sender); public sealed class Square { private readonly int hashcode; public override int GetHashCode() { return hashcode; } public event SquareChanged Change; private Model parent; public NuriProg.View.GridSquare View {get; set;} public int RemainingRoomSize { get; set; } public Square Owner{get;set;} private HashSet<Square> groupMembers; public HashSet<Square> GroupMembers { get { return Owner.groupMembers; } set { groupMembers = value; } } public bool IsSharedRoom { get; set; } public bool Guess { get; set; } public int Level { get; set; } public Square[] Neighbors { get; set; } public Square[] FullNeighbors { get; set; } public byte X { get; private set; } public byte Y { get; private set; } public short RoomSize {get;private set;} private SquareType roomType; public SquareType RoomType { get { return roomType; } set { roomType = value; Level = parent.Level; if (Change!=null) Change(this); } } public Square(short size, byte x, byte y, Model parent) { RemainingRoomSize = 0; IsSharedRoom = false; Owner = null; this.parent = parent; Guess = false; Level = 0; X = x; Y = y; this.hashcode = x + y * parent.Width; if (size > 0) { RoomSize = size; RemainingRoomSize = size; roomType = SquareType.Room; Owner = this; groupMembers = new HashSet<Square>(); groupMembers.Add(this); } else { RoomSize = 0; roomType = SquareType.Unknown; } } } }</pre> <a href="http://www.refactormycode.com/codes/883-square-class" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>