diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 00000000..e0e8389e
Binary files /dev/null and b/.DS_Store differ
diff --git a/DNA/.DS_Store b/DNA/.DS_Store
new file mode 100644
index 00000000..cbb39c0b
Binary files /dev/null and b/DNA/.DS_Store differ
diff --git a/DNA/.idea/.name b/DNA/.idea/.name
new file mode 100644
index 00000000..d052a1f0
--- /dev/null
+++ b/DNA/.idea/.name
@@ -0,0 +1 @@
+DNA
\ No newline at end of file
diff --git a/DNA/.idea/DNA.iml b/DNA/.idea/DNA.iml
new file mode 100644
index 00000000..f9b36de1
--- /dev/null
+++ b/DNA/.idea/DNA.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DNA/.idea/encodings.xml b/DNA/.idea/encodings.xml
new file mode 100644
index 00000000..e206d70d
--- /dev/null
+++ b/DNA/.idea/encodings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/DNA/.idea/misc.xml b/DNA/.idea/misc.xml
new file mode 100644
index 00000000..1162f438
--- /dev/null
+++ b/DNA/.idea/misc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/DNA/.idea/modules.xml b/DNA/.idea/modules.xml
new file mode 100644
index 00000000..38f15aea
--- /dev/null
+++ b/DNA/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/DNA/.idea/scopes/scope_settings.xml b/DNA/.idea/scopes/scope_settings.xml
new file mode 100644
index 00000000..922003b8
--- /dev/null
+++ b/DNA/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/DNA/.idea/vcs.xml b/DNA/.idea/vcs.xml
new file mode 100644
index 00000000..def6a6a1
--- /dev/null
+++ b/DNA/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/DNA/.idea/workspace.xml b/DNA/.idea/workspace.xml
new file mode 100644
index 00000000..93af8162
--- /dev/null
+++ b/DNA/.idea/workspace.xml
@@ -0,0 +1,279 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1352753197494
+ 1352753197494
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DNA/.idea/xcode.xml b/DNA/.idea/xcode.xml
new file mode 100644
index 00000000..c80eabbf
--- /dev/null
+++ b/DNA/.idea/xcode.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/DNA/DNA.xcodeproj/project.pbxproj b/DNA/DNA.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..baeb1bf6
--- /dev/null
+++ b/DNA/DNA.xcodeproj/project.pbxproj
@@ -0,0 +1,257 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ E9131F58164C3A020048034A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9131F57164C3A020048034A /* Foundation.framework */; };
+ E9131F5B164C3A020048034A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E9131F5A164C3A020048034A /* main.m */; };
+ E9131F5F164C3A020048034A /* DNA.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = E9131F5E164C3A020048034A /* DNA.1 */; };
+ E9131F67164C3A2B0048034A /* Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = E9131F66164C3A2B0048034A /* Cell.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ E9131F51164C3A020048034A /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ E9131F5F164C3A020048034A /* DNA.1 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ E9131F53164C3A020048034A /* DNA */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DNA; sourceTree = BUILT_PRODUCTS_DIR; };
+ E9131F57164C3A020048034A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ E9131F5A164C3A020048034A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
+ E9131F5D164C3A020048034A /* DNA-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DNA-Prefix.pch"; sourceTree = ""; };
+ E9131F5E164C3A020048034A /* DNA.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = DNA.1; sourceTree = ""; };
+ E9131F65164C3A2B0048034A /* Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Cell.h; path = Entities/Cell.h; sourceTree = ""; };
+ E9131F66164C3A2B0048034A /* Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Cell.m; path = Entities/Cell.m; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ E9131F50164C3A020048034A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ E9131F58164C3A020048034A /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ E9131F48164C3A020048034A = {
+ isa = PBXGroup;
+ children = (
+ E9131F59164C3A020048034A /* DNA */,
+ E9131F56164C3A020048034A /* Frameworks */,
+ E9131F54164C3A020048034A /* Products */,
+ );
+ sourceTree = "";
+ };
+ E9131F54164C3A020048034A /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ E9131F53164C3A020048034A /* DNA */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ E9131F56164C3A020048034A /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ E9131F57164C3A020048034A /* Foundation.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ E9131F59164C3A020048034A /* DNA */ = {
+ isa = PBXGroup;
+ children = (
+ E9131F68164C3A320048034A /* Entities */,
+ E9131F5A164C3A020048034A /* main.m */,
+ E9131F5E164C3A020048034A /* DNA.1 */,
+ E9131F5C164C3A020048034A /* Supporting Files */,
+ );
+ path = DNA;
+ sourceTree = "";
+ };
+ E9131F5C164C3A020048034A /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ E9131F5D164C3A020048034A /* DNA-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+ E9131F68164C3A320048034A /* Entities */ = {
+ isa = PBXGroup;
+ children = (
+ E9131F65164C3A2B0048034A /* Cell.h */,
+ E9131F66164C3A2B0048034A /* Cell.m */,
+ );
+ name = Entities;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ E9131F52164C3A020048034A /* DNA */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = E9131F62164C3A020048034A /* Build configuration list for PBXNativeTarget "DNA" */;
+ buildPhases = (
+ E9131F4F164C3A020048034A /* Sources */,
+ E9131F50164C3A020048034A /* Frameworks */,
+ E9131F51164C3A020048034A /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = DNA;
+ productName = DNA;
+ productReference = E9131F53164C3A020048034A /* DNA */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ E9131F4A164C3A020048034A /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0450;
+ ORGANIZATIONNAME = EvgenyPlenkin;
+ };
+ buildConfigurationList = E9131F4D164C3A020048034A /* Build configuration list for PBXProject "DNA" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = E9131F48164C3A020048034A;
+ productRefGroup = E9131F54164C3A020048034A /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ E9131F52164C3A020048034A /* DNA */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ E9131F4F164C3A020048034A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ E9131F5B164C3A020048034A /* main.m in Sources */,
+ E9131F67164C3A2B0048034A /* Cell.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ E9131F60164C3A020048034A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ E9131F61164C3A020048034A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ E9131F63164C3A020048034A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "DNA/DNA-Prefix.pch";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ E9131F64164C3A020048034A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "DNA/DNA-Prefix.pch";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ E9131F4D164C3A020048034A /* Build configuration list for PBXProject "DNA" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E9131F60164C3A020048034A /* Debug */,
+ E9131F61164C3A020048034A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ E9131F62164C3A020048034A /* Build configuration list for PBXNativeTarget "DNA" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E9131F63164C3A020048034A /* Debug */,
+ E9131F64164C3A020048034A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = E9131F4A164C3A020048034A /* Project object */;
+}
diff --git a/DNA/DNA.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DNA/DNA.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..f6feef27
--- /dev/null
+++ b/DNA/DNA.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/DNA/DNA.xcodeproj/project.xcworkspace/xcuserdata/plenkinevgeny.xcuserdatad/UserInterfaceState.xcuserstate b/DNA/DNA.xcodeproj/project.xcworkspace/xcuserdata/plenkinevgeny.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 00000000..2ac99946
Binary files /dev/null and b/DNA/DNA.xcodeproj/project.xcworkspace/xcuserdata/plenkinevgeny.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
new file mode 100644
index 00000000..d90256b5
--- /dev/null
+++ b/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
diff --git a/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcschemes/DNA.xcscheme b/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcschemes/DNA.xcscheme
new file mode 100644
index 00000000..24b3a919
--- /dev/null
+++ b/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcschemes/DNA.xcscheme
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcschemes/xcschememanagement.plist b/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 00000000..842f4068
--- /dev/null
+++ b/DNA/DNA.xcodeproj/xcuserdata/plenkinevgeny.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,22 @@
+
+
+
+
+ SchemeUserState
+
+ DNA.xcscheme
+
+ orderHint
+ 0
+
+
+ SuppressBuildableAutocreation
+
+ E9131F52164C3A020048034A
+
+ primary
+
+
+
+
+
diff --git a/DNA/DNA/DNA-Prefix.pch b/DNA/DNA/DNA-Prefix.pch
new file mode 100644
index 00000000..cd50d540
--- /dev/null
+++ b/DNA/DNA/DNA-Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'DNA' target in the 'DNA' project
+//
+
+#ifdef __OBJC__
+ #import
+#endif
diff --git a/DNA/DNA/DNA.1 b/DNA/DNA/DNA.1
new file mode 100644
index 00000000..6a75ffe8
--- /dev/null
+++ b/DNA/DNA/DNA.1
@@ -0,0 +1,79 @@
+.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
+.\"See Also:
+.\"man mdoc.samples for a complete listing of options
+.\"man mdoc for the short list of editing options
+.\"/usr/share/misc/mdoc.template
+.Dd 08.11.12 \" DATE
+.Dt DNA 1 \" Program name and manual section number
+.Os Darwin
+.Sh NAME \" Section Header - required - don't modify
+.Nm DNA,
+.\" The following lines are read in generating the apropos(man -k) database. Use only key
+.\" words here as the database is built based on the words here and in the .ND line.
+.Nm Other_name_for_same_program(),
+.Nm Yet another name for the same program.
+.\" Use .Nm macro to designate other names for the documented program.
+.Nd This line parsed for whatis database.
+.Sh SYNOPSIS \" Section Header - required - don't modify
+.Nm
+.Op Fl abcd \" [-abcd]
+.Op Fl a Ar path \" [-a path]
+.Op Ar file \" [file]
+.Op Ar \" [file ...]
+.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
+arg2 ... \" Arguments
+.Sh DESCRIPTION \" Section Header - required - don't modify
+Use the .Nm macro to refer to your program throughout the man page like such:
+.Nm
+Underlining is accomplished with the .Ar macro like this:
+.Ar underlined text .
+.Pp \" Inserts a space
+A list of items with descriptions:
+.Bl -tag -width -indent \" Begins a tagged list
+.It item a \" Each item preceded by .It macro
+Description of item a
+.It item b
+Description of item b
+.El \" Ends the list
+.Pp
+A list of flags and their descriptions:
+.Bl -tag -width -indent \" Differs from above in tag removed
+.It Fl a \"-a flag as a list item
+Description of -a flag
+.It Fl b
+Description of -b flag
+.El \" Ends the list
+.Pp
+.\" .Sh ENVIRONMENT \" May not be needed
+.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
+.\" .It Ev ENV_VAR_1
+.\" Description of ENV_VAR_1
+.\" .It Ev ENV_VAR_2
+.\" Description of ENV_VAR_2
+.\" .El
+.Sh FILES \" File used or created by the topic of the man page
+.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
+.It Pa /usr/share/file_name
+FILE_1 description
+.It Pa /Users/joeuser/Library/really_long_file_name
+FILE_2 description
+.El \" Ends the list
+.\" .Sh DIAGNOSTICS \" May not be needed
+.\" .Bl -diag
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .El
+.Sh SEE ALSO
+.\" List links in ascending order by section, alphabetically within a section.
+.\" Please do not reference files that do not exist without filing a bug report
+.Xr a 1 ,
+.Xr b 1 ,
+.Xr c 1 ,
+.Xr a 2 ,
+.Xr b 2 ,
+.Xr a 3 ,
+.Xr b 3
+.\" .Sh BUGS \" Document known, unremedied bugs
+.\" .Sh HISTORY \" Document history if command behaves in a unique manner
\ No newline at end of file
diff --git a/DNA/DNA/Entities/Cell.h b/DNA/DNA/Entities/Cell.h
new file mode 100644
index 00000000..b78ce84b
--- /dev/null
+++ b/DNA/DNA/Entities/Cell.h
@@ -0,0 +1,22 @@
+//
+// Cell.h
+// DNA
+//
+// Created by Evgeny Plenkin on 08.11.12.
+// Copyright (c) 2012 EvgenyPlenkin. All rights reserved.
+//
+
+#import
+#include
+
+@interface Cell : NSObject {
+ NSMutableArray *checkDNA;
+ NSArray *letterArray;
+}
+
+@property NSMutableArray *DNA;
+
+-(int)hammingDistance:(Cell *)cell;
+-(void)initCheckDNA;
+
+@end
diff --git a/DNA/DNA/Entities/Cell.m b/DNA/DNA/Entities/Cell.m
new file mode 100644
index 00000000..ab8e7767
--- /dev/null
+++ b/DNA/DNA/Entities/Cell.m
@@ -0,0 +1,43 @@
+//
+// Cell.m
+// DNA
+//
+// Created by Evgeny Plenkin on 08.11.12.
+// Copyright (c) 2012 EvgenyPlenkin. All rights reserved.
+//
+
+#import "Cell.h"
+
+@implementation Cell
+
+-(id)init {
+ self = [super init];
+ _DNA = [[NSMutableArray alloc] init];
+ letterArray = [[NSArray alloc] initWithObjects:@"A",@"T",@"G",@"C", nil];
+ for (int i = 0; i < 100; i++) {
+ int random = arc4random() % 4;
+ [_DNA addObject:[letterArray objectAtIndex:random]];
+ }
+ [self initCheckDNA];
+ return self;
+}
+
+-(int)hammingDistance:(Cell *)cell {
+ int counter = 0;
+ for (int i = 0; i < 100; i++) {
+ NSString *tempString = [_DNA objectAtIndex:i];
+ if ([tempString compare:[[cell DNA] objectAtIndex:i]]) {
+ counter++;
+ }
+ }
+ return counter;
+}
+
+-(void)initCheckDNA {
+ checkDNA = [[NSMutableArray alloc] init];
+ for (int i = 0; i < 100; i++) {
+ [checkDNA addObject:@"NO"];
+ }
+}
+
+@end
diff --git a/DNA/DNA/main.m b/DNA/DNA/main.m
new file mode 100644
index 00000000..6faeb783
--- /dev/null
+++ b/DNA/DNA/main.m
@@ -0,0 +1,52 @@
+//
+// main.m
+// DNA
+//
+// Created by Evgeny Plenkin on 08.11.12.
+// Copyright (c) 2012 EvgenyPlenkin. All rights reserved.
+//
+
+#import
+#import "Cell.h"
+
+@interface Cell (MutateCell);
+-(void)mutate:(int) i;
+@end
+
+@implementation Cell (MutateCell)
+
+-(void)mutate:(int)percent {
+ int count = 1;
+ while (count <= percent) {
+ int random100 = arc4random() % 100;
+ if ([[checkDNA objectAtIndex:random100] isEqualToString:@"NO"]) {
+ [checkDNA setObject:@"YES" atIndexedSubscript:random100];
+ int random4 = arc4random() % 4;
+ [[self DNA] setObject:[letterArray objectAtIndex:random4] atIndexedSubscript:random100];
+ count++;
+ }
+ }
+ [self initCheckDNA];
+}
+
+@end
+
+int main(int argc, const char * argv[])
+{
+
+ @autoreleasepool {
+
+ Cell *firstCell = [[Cell alloc] init];
+ Cell *secondCell = [[Cell alloc] init];
+
+ NSLog(@"Hamming distance before mutate:%i",[firstCell hammingDistance:secondCell]);
+
+ [firstCell mutate:100];
+ [secondCell mutate:35];
+
+ NSLog(@"Hamming distance after mutate:%i",[firstCell hammingDistance:secondCell]);
+
+ }
+ return 0;
+}
+