This is Die.m in view mode; [Download] [Up]
// Kismet // Copyright (C) 1994, Joseph W. Reiss, All Rights Reserved // jreiss@magnus.acs.ohio-state.edu ///////////////////////////////////////////////////////////////////////////// // You are free to modify this code as you wish for your own personal use. // You may only REDISTRIBUTE the code unaltered, with this copyright notice // and all documentation intact. // // If you make any significant changes to this program, please drop me a // line and let me know! #import <time.h> #import "Die.h" @implementation Die + initialize { srandom((int)time(NULL)); return self; } - init { value = 1; return self; } - (int) roll { value = random() % 6 + 1; return value; } - setValue:(int) newValue { if (1 <= newValue && newValue <= 6) value = newValue; return self; } - (int)value { return value; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.