diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..e0c74c4b Binary files /dev/null and b/.DS_Store differ diff --git a/ProjectOne/.DS_Store b/ProjectOne/.DS_Store new file mode 100644 index 00000000..bd840b5d Binary files /dev/null and b/ProjectOne/.DS_Store differ diff --git a/ProjectOne/ProjectOne.xcodeproj/project.pbxproj b/ProjectOne/ProjectOne.xcodeproj/project.pbxproj new file mode 100644 index 00000000..8f12225c --- /dev/null +++ b/ProjectOne/ProjectOne.xcodeproj/project.pbxproj @@ -0,0 +1,250 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 5614F479164C7A4500E1EA05 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5614F478164C7A4500E1EA05 /* Foundation.framework */; }; + 5614F47C164C7A4500E1EA05 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5614F47B164C7A4500E1EA05 /* main.m */; }; + 5614F480164C7A4500E1EA05 /* ProjectOne.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5614F47F164C7A4500E1EA05 /* ProjectOne.1 */; }; + 5614F488164C7A5500E1EA05 /* Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 5614F487164C7A5500E1EA05 /* Cell.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 5614F472164C7A4500E1EA05 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 5614F480164C7A4500E1EA05 /* ProjectOne.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 5614F474164C7A4500E1EA05 /* ProjectOne */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ProjectOne; sourceTree = BUILT_PRODUCTS_DIR; }; + 5614F478164C7A4500E1EA05 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 5614F47B164C7A4500E1EA05 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 5614F47E164C7A4500E1EA05 /* ProjectOne-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ProjectOne-Prefix.pch"; sourceTree = ""; }; + 5614F47F164C7A4500E1EA05 /* ProjectOne.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = ProjectOne.1; sourceTree = ""; }; + 5614F486164C7A5500E1EA05 /* Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cell.h; sourceTree = ""; }; + 5614F487164C7A5500E1EA05 /* Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Cell.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5614F471164C7A4500E1EA05 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5614F479164C7A4500E1EA05 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5614F469164C7A4500E1EA05 = { + isa = PBXGroup; + children = ( + 5614F47A164C7A4500E1EA05 /* ProjectOne */, + 5614F477164C7A4500E1EA05 /* Frameworks */, + 5614F475164C7A4500E1EA05 /* Products */, + ); + sourceTree = ""; + }; + 5614F475164C7A4500E1EA05 /* Products */ = { + isa = PBXGroup; + children = ( + 5614F474164C7A4500E1EA05 /* ProjectOne */, + ); + name = Products; + sourceTree = ""; + }; + 5614F477164C7A4500E1EA05 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 5614F478164C7A4500E1EA05 /* Foundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 5614F47A164C7A4500E1EA05 /* ProjectOne */ = { + isa = PBXGroup; + children = ( + 5614F47B164C7A4500E1EA05 /* main.m */, + 5614F486164C7A5500E1EA05 /* Cell.h */, + 5614F487164C7A5500E1EA05 /* Cell.m */, + 5614F47F164C7A4500E1EA05 /* ProjectOne.1 */, + 5614F47D164C7A4500E1EA05 /* Supporting Files */, + ); + path = ProjectOne; + sourceTree = ""; + }; + 5614F47D164C7A4500E1EA05 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 5614F47E164C7A4500E1EA05 /* ProjectOne-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 5614F473164C7A4500E1EA05 /* ProjectOne */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5614F483164C7A4500E1EA05 /* Build configuration list for PBXNativeTarget "ProjectOne" */; + buildPhases = ( + 5614F470164C7A4500E1EA05 /* Sources */, + 5614F471164C7A4500E1EA05 /* Frameworks */, + 5614F472164C7A4500E1EA05 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ProjectOne; + productName = ProjectOne; + productReference = 5614F474164C7A4500E1EA05 /* ProjectOne */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5614F46B164C7A4500E1EA05 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = "Pavel Gerashchenko"; + }; + buildConfigurationList = 5614F46E164C7A4500E1EA05 /* Build configuration list for PBXProject "ProjectOne" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 5614F469164C7A4500E1EA05; + productRefGroup = 5614F475164C7A4500E1EA05 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 5614F473164C7A4500E1EA05 /* ProjectOne */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 5614F470164C7A4500E1EA05 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5614F47C164C7A4500E1EA05 /* main.m in Sources */, + 5614F488164C7A5500E1EA05 /* Cell.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 5614F481164C7A4500E1EA05 /* 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; + }; + 5614F482164C7A4500E1EA05 /* 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; + }; + 5614F484164C7A4500E1EA05 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ProjectOne/ProjectOne-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 5614F485164C7A4500E1EA05 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "ProjectOne/ProjectOne-Prefix.pch"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5614F46E164C7A4500E1EA05 /* Build configuration list for PBXProject "ProjectOne" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5614F481164C7A4500E1EA05 /* Debug */, + 5614F482164C7A4500E1EA05 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5614F483164C7A4500E1EA05 /* Build configuration list for PBXNativeTarget "ProjectOne" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5614F484164C7A4500E1EA05 /* Debug */, + 5614F485164C7A4500E1EA05 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5614F46B164C7A4500E1EA05 /* Project object */; +} diff --git a/ProjectOne/ProjectOne.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ProjectOne/ProjectOne.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..56ae548e --- /dev/null +++ b/ProjectOne/ProjectOne.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ProjectOne/ProjectOne.xcodeproj/project.xcworkspace/xcuserdata/pavelgerashchenko.xcuserdatad/UserInterfaceState.xcuserstate b/ProjectOne/ProjectOne.xcodeproj/project.xcworkspace/xcuserdata/pavelgerashchenko.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..1b8e4404 Binary files /dev/null and b/ProjectOne/ProjectOne.xcodeproj/project.xcworkspace/xcuserdata/pavelgerashchenko.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 00000000..05301bc2 --- /dev/null +++ b/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcschemes/ProjectOne.xcscheme b/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcschemes/ProjectOne.xcscheme new file mode 100644 index 00000000..b6a778f6 --- /dev/null +++ b/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcschemes/ProjectOne.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcschemes/xcschememanagement.plist b/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..9de221f7 --- /dev/null +++ b/ProjectOne/ProjectOne.xcodeproj/xcuserdata/pavelgerashchenko.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + ProjectOne.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 5614F473164C7A4500E1EA05 + + primary + + + + + diff --git a/ProjectOne/ProjectOne/.DS_Store b/ProjectOne/ProjectOne/.DS_Store new file mode 100644 index 00000000..f6a65fe0 Binary files /dev/null and b/ProjectOne/ProjectOne/.DS_Store differ diff --git a/ProjectOne/ProjectOne/Cell.h b/ProjectOne/ProjectOne/Cell.h new file mode 100644 index 00000000..a8d5b293 --- /dev/null +++ b/ProjectOne/ProjectOne/Cell.h @@ -0,0 +1,25 @@ +// +// Cell.h +// ProjectOne +// +// Created by Pavel Gerashchenko on 09.11.12. +// Copyright (c) 2012 Pavel Gerashchenko. All rights reserved. +// + +#import + +@interface Cell : NSObject +{ + int i,r; + int percent; + NSMutableArray *arrayTemp; + NSArray *chars; + NSMutableArray *DNA; + +} +-(id)init; +-(int)hammingDistance:(Cell *)cell; +@property (readonly) NSMutableArray *DNA; + + +@end diff --git a/ProjectOne/ProjectOne/Cell.m b/ProjectOne/ProjectOne/Cell.m new file mode 100644 index 00000000..895b649c --- /dev/null +++ b/ProjectOne/ProjectOne/Cell.m @@ -0,0 +1,40 @@ +// +// Cell.m +// ProjectOne +// +// Created by Pavel Gerashchenko on 09.11.12. +// Copyright (c) 2012 Pavel Gerashchenko. All rights reserved. +// + +#import "Cell.h" + +@implementation Cell +@synthesize DNA; + +- (id)init +{ + if (self = [super init]) { + chars = [[NSArray alloc] initWithObjects:@"A",@"T",@"G",@"C", nil ]; + DNA = [[NSMutableArray alloc] initWithCapacity:100]; + srandom((unsigned) time(NULL)); + for (i=0; i<=100; i++) { + r = arc4random_uniform(4); + [DNA insertObject:chars[r] atIndex:i]; + } + } + return self; +} +-(int)hammingDistance:(Cell *)cell +{ + int m = 0; + for (i=0; i<=100; i++) + if (DNA[i] == cell.DNA[i] ) { + m++; + + } + return m; +} + + + +@end diff --git a/ProjectOne/ProjectOne/ProjectOne-Prefix.pch b/ProjectOne/ProjectOne/ProjectOne-Prefix.pch new file mode 100644 index 00000000..43064f80 --- /dev/null +++ b/ProjectOne/ProjectOne/ProjectOne-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'ProjectOne' target in the 'ProjectOne' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/ProjectOne/ProjectOne/ProjectOne.1 b/ProjectOne/ProjectOne/ProjectOne.1 new file mode 100644 index 00000000..0ad3e82f --- /dev/null +++ b/ProjectOne/ProjectOne/ProjectOne.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 09.11.12 \" DATE +.Dt ProjectOne 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm ProjectOne, +.\" 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/ProjectOne/ProjectOne/main.m b/ProjectOne/ProjectOne/main.m new file mode 100644 index 00000000..2c942eb4 --- /dev/null +++ b/ProjectOne/ProjectOne/main.m @@ -0,0 +1,55 @@ +// +// main.m +// ProjectOne +// +// Created by Pavel Gerashchenko on 09.11.12. +// Copyright (c) 2012 Pavel Gerashchenko. All rights reserved. +// + +#import +#import "Cell.h" +@interface Cell (mutator) { + +} +-(void) mutate:(int) x; +@end + +@implementation Cell (mutator) + +//Проблема :( не успеваю разобраться +-(void) mutate: (int) x { + int p,h; + for (p=0;p<=x;p++) { + h = arc4random_uniform(4); + [arrayTemp insertObject:chars[h] atIndex:p]; + if (arrayTemp[p] == DNA[p]) { + p=p-1; + } + else + + [DNA insertObject:arrayTemp[p] atIndex:p]; + } +} + +@end + + + +int main(int argc, const char * argv[]) +{ + + @autoreleasepool { + + Cell *dnaCell = [[Cell alloc] init]; + Cell *dnaTwoCell = [[Cell alloc] init]; + NSLog(@"Isss %d", [dnaCell hammingDistance:dnaTwoCell]); + + [dnaCell mutate:25 ]; + + NSLog(@"Isss %d %lu", [dnaCell hammingDistance:dnaTwoCell],[dnaCell.DNA count]); + + } + return 0; +} + + diff --git a/ProjectOne/ProjectOne/osx-project-1 b/ProjectOne/ProjectOne/osx-project-1 new file mode 160000 index 00000000..38bebaf0 --- /dev/null +++ b/ProjectOne/ProjectOne/osx-project-1 @@ -0,0 +1 @@ +Subproject commit 38bebaf0eac24e8bef2d30f034582d13e464ca09