Welcome, Guest

Author Topic: Coding  (Read 262368 times)

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Python
« Reply #300 on: November 25, 2013, 12:52:01 PM »
i would but
1. idk how to time it and
2. i'd get second because me and kip would be the only dudes doing it

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Python
« Reply #301 on: November 25, 2013, 12:52:28 PM »
EDIT: wait darvince was refering to telephone numbers

FiahOwl

  • *****
  • Posts: 1234
  • This is, to give a dog and in recompense desire my dog again.
Re: Python
« Reply #302 on: November 27, 2013, 12:54:30 PM »

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '113376'.

« Last Edit: March 22, 2021, 01:25:30 AM by FiahOwl »

blotz

  • Formerly 'bong'
  • *****
  • Posts: 813
  • op pls
Re: Python
« Reply #303 on: November 27, 2013, 01:46:08 PM »
tell me in 2 days how you're doing

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Python
« Reply #304 on: December 04, 2013, 09:07:29 PM »
LEVLEN:

the function levplot takes a list of segment lengths, attaches them end to end in one long snake, and rotates each pivot randomly. the distance of the tip of the segment from the origin is plotted as a histogram.

usage example in interpreter

import os
os.chdir("c:\\kolkon\\pathname")
execfile('levlen.py')

levplot([1,2,3])
levplot([range(5)])
levplot([x**2 for x in list(reversed(range(10)))])
levplot([1,1],1000000,500) #1 million samples (normal is 100000) and 500 bins (normal is 200)

the following are example results. filename shows the list passed to levplot.

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Python
« Reply #305 on: December 06, 2013, 08:38:30 PM »
method of setting up a multi-player game without needing to port forward by using freenode which can transmit around 1 kB/second

atomic7732

  • Global Moderator
  • *****
  • Posts: 3848
  • caught in the river turning blue
    • Paladin of Storms
Re: Python
« Reply #306 on: December 06, 2013, 08:54:11 PM »
that doesn't seem very traditional lol

interesting

Bla

  • Global Moderator
  • *****
  • Posts: 1013
  • The stars died so you can live.
Re: Python
« Reply #307 on: December 07, 2013, 04:44:42 AM »
Kol, that should work fine for Map War 3 I guess.

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Python
« Reply #308 on: December 07, 2013, 07:50:57 AM »
i still have the dilemma of preventing one player from pretending to be another and screwing up the game that way. perhaps i will have each player generate a low value hashcoin and encrypt it with a short private key to ensure identities are correct

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Python
« Reply #309 on: December 10, 2013, 07:46:48 PM »
further elaboration of freenode setup shown previously. it's not cryptographically secure, but most people without a degree in cryptography would have a hard time cracking it

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Python
« Reply #310 on: December 11, 2013, 11:41:41 PM »
code for alternative voting system to be used in blavision (or other applications). example from wikipedia included.

Code: [Select]
def dez(ditc): #delete zeroes
    dlist = []
    for key in ditc:
        if not(ditc[key]):
            dlist.append(key)
    for k in dlist:
        del ditc[k]

def calc(choicelist, votelist):
    cdict = {}
    for c in choicelist:
        cdict[c] = 0
    for v in votelist:
        cdict[v[0]] += 1 #replace this line with something more robust
    dez(cdict) #delete zeroes
    while 1:
        vcount = sum((len(v) for v in votelist))
        larg = max(cdict, key = cdict.get)
        if cdict[larg]*2 > vcount: #terminate if over 50% vote
            return larg
        rem = min(cdict, key = cdict.get) #find min
        del cdict[rem] #remove min
        for v in votelist:
            i = v.index(rem) #Get index
            if i == 0: #remove previous vote
                del v[0] #then delete the name
                if len(v) == 0:
                    del v
                    break
                elif v[0] in cdict:
                    cdict[v[0]] += 1 #deleted
            if i != -1:
                del v[i]
                if len(v) == 0:
                    del v

#test samples
choicelist = ['bob', 'sue', 'bill']

v1 = ['bob', 'bill', 'sue']
v2 = ['sue', 'bob', 'bill']
v3 = ['bill', 'sue', 'bob']
v4 = ['bob', 'bill', 'sue']
v5 = ['sue', 'bob', 'bill']

votelist = [v1,v2,v3,v4,v5]

print calc(choicelist, votelist)
               
       
       
   

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #311 on: December 12, 2013, 01:58:43 PM »
the ackerman function is a beautiful 4 lines in lisp

Code: [Select]
(define (ack m n)
  (cond ((= m 0) (+ n 1))
        ((= n 0) (ack (- m 1) 1))
        (else (ack (- m 1) (ack m (- n 1))))))
 
(define x (ack 3 9))

(print x)

Darvince

  • *****
  • Posts: 1842
  • 差不多
Re: Coding
« Reply #312 on: December 12, 2013, 02:26:04 PM »
What does the Ackermann function do?

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #313 on: December 12, 2013, 02:29:08 PM »
make big numbers

"Its value grows rapidly, even for small inputs. For example A(4,2) is an integer of 19,729 decimal digits.[2]"

Darvince

  • *****
  • Posts: 1842
  • 差不多
Re: Coding
« Reply #314 on: December 12, 2013, 02:32:40 PM »
No what does it actually do, does it like grow 4,2 into 4^2 * 4^1 * 4^0 * 3^2 * 3^1 * 3^0 * 2^2 * 2^1 * 2^0 * 1^2 * 1^1 * 1^0?

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #315 on: December 12, 2013, 03:51:34 PM »
Code: [Select]
A(4, 2) = A(3, A(4, 1))
 = A(3, A(3, A(4, 0)))
 = A(3, A(3, A(3, 1)))
 = A(3, A(3, A(2, A(3, 0))))
 = A(3, A(3, A(2, A(2, 1))))
 = A(3, A(3, A(2, A(1, A(2, 0)))))
 = A(3, A(3, A(2, A(1, A(1, 1)))))
 = A(3, A(3, A(2, A(1, A(0, A(1, 0))))))
 = A(3, A(3, A(2, A(1, A(0, A(0, 1))))))
 = A(3, A(3, A(2, A(1, A(0, 2)))))
 = A(3, A(3, A(2, A(1, 3))))
 = A(3, A(3, A(2, A(0, A(1, 2)))))
 = A(3, A(3, A(2, A(0, A(0, A(1, 1))))))
 = A(3, A(3, A(2, A(0, A(0, A(0, A(1, 0)))))))
 = A(3, A(3, A(2, A(0, A(0, A(0, A(0, 1)))))))
 = A(3, A(3, A(2, A(0, A(0, A(0, 2))))))
 = A(3, A(3, A(2, A(0, A(0, 3)))))
 = A(3, A(3, A(2, A(0, 4))))
 = A(3, A(3, A(2, 5)))
 = A(3, A(3, A(1, A(2, 4))))
 = A(3, A(3, A(1, A(1, A(2, 3)))))
 = A(3, A(3, A(1, A(1, A(1, A(2, 2))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(2, 1)))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(1, A(2, 0))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(1, A(1, 1))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(1, A(0, A(1, 0)))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(1, A(0, A(0, 1)))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(1, A(0, 2))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(1, 3)))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(0, A(1, 2))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(0, A(0, A(1, 1)))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(0, A(0, A(0, A(1, 0))))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(0, A(0, A(0, A(0, 1))))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(0, A(0, A(0, 2)))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(0, A(0, 3))))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, A(0, 4)))))))
 = A(3, A(3, A(1, A(1, A(1, A(1, 5))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(1, 4)))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(1, 3))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(0, A(1, 2)))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(0, A(0, A(1, 1))))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(1, 0)))))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(0, 1)))))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(0, A(0, A(0, 2))))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(0, A(0, 3)))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, A(0, 4))))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, A(0, 5)))))))
 = A(3, A(3, A(1, A(1, A(1, A(0, 6))))))
 = A(3, A(3, A(1, A(1, A(1, 7)))))
 = A(3, A(3, A(1, A(1, A(0, A(1, 6))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(1, 5)))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(1, 4))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(1, 3)))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(1, 2))))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 1)))))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 0))))))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 1))))))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 2)))))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(0, A(0, 3))))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, A(0, 4)))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, A(0, 5))))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, A(0, 6)))))))
 = A(3, A(3, A(1, A(1, A(0, A(0, 7))))))
 = A(3, A(3, A(1, A(1, A(0, 8)))))
 = A(3, A(3, A(1, A(1, 9))))
 = A(3, A(3, A(1, A(0, A(1, 8)))))
 = A(3, A(3, A(1, A(0, A(0, A(1, 7))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(1, 6)))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(1, 5))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(1, 4)))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 3))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 2)))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 1))))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 0)))))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 1)))))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 2))))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 3)))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 4))))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, A(0, 5)))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, A(0, 6))))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, A(0, 7)))))))
 = A(3, A(3, A(1, A(0, A(0, A(0, 8))))))
 = A(3, A(3, A(1, A(0, A(0, 9)))))
 = A(3, A(3, A(1, A(0, 10))))
 = A(3, A(3, A(1, 11)))
 = A(3, A(3, A(0, A(1, 10))))
 = A(3, A(3, A(0, A(0, A(1, 9)))))
 = A(3, A(3, A(0, A(0, A(0, A(1, 8))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(1, 7)))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(1, 6))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 5)))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 4))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 3)))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 2))))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 1)))))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(1, 0))))))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 1))))))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 2)))))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 3))))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 4)))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 5))))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, A(0, 6)))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, A(0, 7))))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, A(0, 8)))))))
 = A(3, A(3, A(0, A(0, A(0, A(0, 9))))))
 = A(3, A(3, A(0, A(0, A(0, 10)))))
 = A(3, A(3, A(0, A(0, 11))))
 = A(3, A(3, A(0, 12)))
 = A(3, A(3, 13))
 = A(3, A(2, A(3, 12)))
 = A(3, A(2, A(2, A(3, 11))))
 = A(3, A(2, A(2, A(2, A(3, 10)))))
 = A(3, A(2, A(2, A(2, A(2, A(3, 9))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(3, 8)))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 7))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 6)))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 5))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 4)))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 3))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 2)))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 1))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(3, 0)))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, 1)))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(2, 0))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, 1))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(0, A(1, 0)))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(0, A(0, 1)))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(0, 2))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, 3)))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(0, A(1, 2))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(0, A(0, A(1, 1)))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(0, A(0, A(0, A(1, 0))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(0, A(0, A(0, A(0, 1))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(0, A(0, A(0, 2)))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(0, A(0, 3))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(0, 4)))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, 5))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(2, 4)))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(2, 3))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(2, 2)))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(2, 1))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(1, A(2, 0)))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(1, A(1, 1)))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(1, A(0, A(1, 0))))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(1, A(0, A(0, 1))))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(1, A(0, 2)))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(1, 3))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(0, A(1, 2)))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(0, A(0, A(1, 1))))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(0, A(0, A(0, A(1, 0)))))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(0, A(0, A(0, A(0, 1)))))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(0, A(0, A(0, 2))))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(0, A(0, 3)))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, A(0, 4))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(1, 5)))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(0, A(1, 4))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(0, A(0, A(1, 3)))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(0, A(0, A(0, A(1, 2))))))))))))))))))))
 = A(3, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(2, A(1, A(1, A(1, A(0, A(0, A(0, A(0, A(1, 1)))))))))))))))))))))
 .............
 etc

Darvince

  • *****
  • Posts: 1842
  • 差不多
Re: Coding
« Reply #316 on: December 12, 2013, 05:42:11 PM »
what the fuck

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #317 on: December 12, 2013, 05:53:09 PM »
yes.

in fact, the ackerman function is used as a computational benchmark

Darvince

  • *****
  • Posts: 1842
  • 差不多
Re: Coding
« Reply #318 on: December 12, 2013, 09:36:30 PM »
osmotischen the stratosphere affects weather (since pygcm seems to be turning into pygwm)

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #319 on: December 12, 2013, 09:53:16 PM »
care to elaborate?

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #320 on: December 14, 2013, 12:33:44 AM »
2d simplex noise

fairly self-explanatory and simple. you'll need the libraries

noise: http://www.lfd.uci.edu/~gohlke/pythonlibs/#noise
numpy and matplotlib

Code: [Select]
import noise
import numpy as np
import matplotlib.pyplot as plt

def narray(xs, ys, s, p = 0.5, oct = 3):
    r = [[noise.snoise2(x/s, y/s, octaves = oct, persistence = p) for y in xrange(0,ys)] for x in xrange(0,xs)]
    return np.array(r)

g = narray(1000,1000,500.0, oct = 5)
plt.imshow(g)
plt.show()

result:

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #321 on: December 15, 2013, 03:19:18 AM »
LOS maps based on the above heightmap

(line of sight).

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #322 on: December 15, 2013, 07:00:19 PM »
requires 32 bit python and the library pyglet

right now it just shows a bunch of triangles. within a few days it should render a 3d figure. within a week, i might get something like fly mode working with a height map. then i'll try some shaders out

atomic7732

  • Global Moderator
  • *****
  • Posts: 3848
  • caught in the river turning blue
    • Paladin of Storms
Re: Coding
« Reply #323 on: December 16, 2013, 10:36:03 AM »
how do line of sights work

i'm trying to imagine silhouettes but im not getting anything

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #324 on: December 16, 2013, 12:50:11 PM »
well right now i only need to determine line of sight between two objects given a heightmap in the form of an array. i draw a supercover line between the objects, and check each grid square it intersects to make sure it does not block the line of sight.

what you see above is the result of using this algorithm with a the center point and every pixel on the map. impractical for official use

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #325 on: December 16, 2013, 09:42:39 PM »
i gave my first stackoverflow answer! check it out, or dont.

http://stackoverflow.com/a/20624839/1858363

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #326 on: December 17, 2013, 07:18:36 PM »

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #327 on: December 30, 2013, 12:00:09 AM »
a framework for musics.

the first 45 lines of this file is a framework with which to work with. the second part is a function that creates a song using the framework. a sample of the music produced is uploaded

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #328 on: December 30, 2013, 01:14:48 AM »
<rodafk>darv have you ever figured out your sexuality
<Darvince>rodafk uhh mostly
<rodafk>what about you kal
<rodafk>i know vh is codesexual
<rodafk>you're always coding like a madman
<rodafk>new code appears everyday
<rodafk>born like rabbits
« Last Edit: October 21, 2014, 02:19:20 PM by vh »

vh

  • formerly mudkipz
  • *****
  • Posts: 1140
  • "giving heat meaning"
Re: Coding
« Reply #329 on: January 01, 2014, 11:18:12 AM »
Code: [Select]
import os
import glob
from lxml import etree
import cPickle
import gzip
import time
import thread
import winsound

start = time.time()

def preprocessor(file):
    invalid = [['&#x1A;','']]
    with gzip.open(file,'r') as original:
        with gzip.open('~'+file,'w') as temp:
            m = original.readline()
            while m != '':
                for i in invalid:
                    m = m.replace(i[0],i[1])
                temp.write(m)
                m = original.readline()
    os.remove(file)
    os.rename('~'+file,file)
   
class NATION:
    def __init__(self, name, type, fullname, motto, category, un, civil, economy, political, region, population, tax, animal, currency, flag, industry,
                 priority, environment, equality, education, law, administration, welfare, spirituality, defence, transportation, healthcare, commerce,
                 founded, firstlogin, lastlogin, activity, influence, public, leader, capital, religion):
        self.name = name
        self.type = type
        self.fullname = fullname
        self.motto = motto
        self.category = category
        self.unstatus = un
        self.freedomscores = {'civilrights':civil, 'economy':economy, 'politicalfreedom':political}
        self.region = region
        self.population = population
        self.tax = tax
        self.animal = animal
        self.currency = currency
        self.flaglink = flag
        self.majorindustry = industry
        self.govtpriority = priority
        self.govt = {'environment':environment, 'socialequality':equality, 'education':education, 'lawandorder':law, 'administration':administration,
                     'welfare':welfare, 'spirituality':spirituality, 'defence':defence, 'publictransport':transportation, 'healthcare':healthcare,
                     'commerce':commerce}
        self.founded = founded
        self.firstlogin = firstlogin
        self.lastlogin = lastlogin
        self.influence = influence
        self.publicsector = public
        self.leader = leader
        self.capital = capital
        self.religion = religion
        self.lastactivity = activity
       
def create(file):
    print 'processing '+ file
    nationlist = []
    _dump = gzip.open(file, 'r')
    try:
        parseddump = (etree.parse(_dump)).getroot()
    except:
        print 'error'
        _dump.close()
        preprocessor(file)
        create(file)
        return 0
    _dump.close()
    for nation in parseddump:
        nationlist.append(NATION(
            nation[0].text, nation[1].text, nation[2].text, nation[3].text, nation[4].text, bool(nation[5].text[0] == 'W'),
            int(nation[21][0].text.strip('%')), int(nation[21][1].text.strip('%')), int(nation[21][2].text.strip('%')),
            nation[7].text, int(nation[8].text), int(nation[9].text), nation[10].text, nation[11].text, nation[12].text, nation[13].text, nation[14].text,
            int(nation[15][0].text.strip('%')), int(nation[15][1].text.strip('%')), int(nation[15][2].text.strip('%')), int(nation[15][3].text.strip('%')),
            int(nation[15][4].text.strip('%')), int(nation[15][5].text.strip('%')), int(nation[15][6].text.strip('%')), int(nation[15][7].text.strip('%')),
            int(nation[15][8].text.strip('%')), int(nation[15][9].text.strip('%')), int(nation[15][10].text.strip('%')),
            nation[16].text, int(nation[17].text), int(nation[18].text), nation[19].text, nation[20].text,
            int(nation[22].text.strip('%')), nation[23].text,nation[24].text, nation[25].text))
    with gzip.open(file[:file.find('.')]+'output','wb') as outputfile:
        cPickle.dump(nationlist, outputfile)
    parseddump = None

with open("error.txt", 'w') as f:
    f.write('this is the error log\n')
for file in glob.glob("*.gz"):
    try:
        create(file)
    except:
        winsound.Beep(2000,2000)
        print 'error', file
        with open("error.txt",'a') as ef:
            ef.write(file+'\n')
   
print time.time()-start

this is an update of dump_processor.py
some files don't extract if they're on an external hd for some reason, so i added an error log to catch those problems.

link to original below
.