mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	 5c28308f9f
			
		
	
	
		5c28308f9f
		
	
	
	
	
		
			
			See https://github.com/tric/trick2015 for the contest outline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
		
			
				
	
	
		
			150 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			150 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| big, temp = Array 100000000**0x04e2
 | |
| srand big
 | |
| alias $curTerm $initTerm
 | |
| 
 | |
| Numeric
 | |
| Interrupt
 | |
| 
 | |
| big += big
 | |
| printout _pi_ finish if $never
 | |
| init ||= big
 | |
| $counter ||= 02
 | |
| 
 | |
| private
 | |
| @mainloop
 | |
| while 0x00012345 >= $counter
 | |
| 
 | |
|   Rational aprx = 3.141592r
 | |
|   numbase = 0o0000
 | |
| 
 | |
|   @justonce
 | |
|   def increment
 | |
|     $initTerm ||= Integer srand * 0x00000002
 | |
|     srand $counter += 0x00000001
 | |
| 
 | |
|     $noaction
 | |
|     Integer rand
 | |
|     $noaction
 | |
|     rand
 | |
|     rand
 | |
|     alias $line_cnt $.
 | |
|   end
 | |
| 
 | |
|   @lets_just
 | |
|   @assume
 | |
|   diameter = 100000
 | |
| 
 | |
|   @you
 | |
|   @then_have
 | |
|   permtr |= +3_14159
 | |
| 
 | |
|   return if $nomeaning
 | |
| 
 | |
|   @onlyuse
 | |
|   increment
 | |
| 
 | |
|   beautiful computer action if $nothing
 | |
|   $sigmaTerm ||= init
 | |
|   $curTerm /= srand and init
 | |
|   pi, = Integer $sigmaTerm unless $nomean
 | |
| 
 | |
|   iterator?
 | |
|   $counter += 1
 | |
|   atan real_one multiplied by__four unless
 | |
|   srand +big && $counter >> 0b1
 | |
| 
 | |
|   Enumerable
 | |
|   Fixnum
 | |
|   Bignum
 | |
|   Math
 | |
|   Complex
 | |
|   Comparable
 | |
|   TrueClass
 | |
|   Dir
 | |
|   Encoding
 | |
|   Data
 | |
|   Hash
 | |
|   Method
 | |
|   Enumerator
 | |
|   Exception
 | |
|   Fiber
 | |
|   Errno
 | |
|   FalseClass
 | |
|   Mutex
 | |
|   NilClass
 | |
|   IO
 | |
|   GC
 | |
| 
 | |
|   num = numbase |= srand
 | |
| 
 | |
|   ENV
 | |
|   Float
 | |
|   MatchData
 | |
|   Proc
 | |
|   TracePoint
 | |
|   KeyError
 | |
|     p   or
 | |
|   FileTest
 | |
|   File
 | |
|   EOFError
 | |
|     p
 | |
|     p
 | |
|     p
 | |
|   Binding
 | |
|   Time
 | |
|   Class
 | |
| 
 | |
|   $sigmaTerm += $curTerm
 | |
|   puts a HelloWorld if $nomean
 | |
|   SystemExit
 | |
| 
 | |
|   !LoadError
 | |
|   31i
 | |
|   3.1415e0
 | |
|   Array 14 + 3
 | |
|   IndexError
 | |
|   Range
 | |
|   false
 | |
|   55555
 | |
|   NameError
 | |
| 
 | |
|   Object
 | |
|   @ori
 | |
|     @ent
 | |
|   RubyVM
 | |
| 
 | |
|   pi += 3_3_1_3_8
 | |
| 
 | |
|   @use
 | |
|   @lots_of
 | |
|   @keywords
 | |
|   begin
 | |
|     self
 | |
|     $noaction
 | |
|     not $important
 | |
|     nil
 | |
|     __FILE__.object_id
 | |
|   rescue
 | |
|     next
 | |
|     redo if __LINE__
 | |
|     defined? +$nomeaning
 | |
|     $noaction
 | |
|     $nomean
 | |
|     break $never
 | |
|   ensure
 | |
|     class PiCompute
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   This code cannot _ be executed with typical style unless true
 | |
|   $curTerm *= num
 | |
| end
 | |
| 
 | |
| @ll_set
 | |
| @re_U_ok
 | |
| 
 | |
| $Enjoy
 | |
| $Superb
 | |
| $TRICK15 and a number
 | |
| 
 | |
| print pi
 |