Editing User talk:Danf

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 12: Line 12:


howzit?
howzit?
Nothing going tonight. Up late, needing sleep. See you tomorrow. PS found a light read on mind/brain sleep research in the 20th century, linked under current readings. -kevin
== ditto ==
Thanks
[[User:Immonad|Immonad]] ([[User talk:Immonad|talk]]) 18:40, 31 July 2013 (UTC)
== this is an example of a note to say hello via wiki because email is a broken protocol, considered harmful, and depracatable ==
'''say what ???''' --[[User:Danf|Danf]] ([[User talk:Danf|talk]]) 01:18, 22 August 2013 (UTC)
== Good stuff ==
By golly have a listen
http://www.fourier-series.com/f-transform/index.html
== Connectivity Restored... ==
to switch 31, aka the collaboration station.
https://en.wikipedia.org/wiki/Foobar
== ??? ==
    def egcd(a, b):
        if a == 0:
            return (b, 0, 1)
        else:
            g, y, x = egcd(b % a, a)
            return (g, x - (b // a) * y, y)
https://en.wikibooks.org/wiki/Algorithm_Implementation/Mathematics/Extended_Euclidean_algorithm
I've never seen anything like it.
== hey dan ==
Chris here. Good talking last night. Here's the deep learning site I mentioned. deeplearning4j.org. Curious to hear what you think.
== Bluetooth Dongle ==
I think we have a BS009 from BlueSoleil
http://www.bluesoleil.com/products/H0001201304230001.html
== HTML5 Canvas Element ==
Thought you might like to play around with this.. I just stumbeled on this shape hacking a grid together.
   
    <html>                                                                             
      <head>                                                                           
        <title>@title</title>                                                           
        <script type="text/javascript">                                                 
          function rect(ctx, grid, step, cur){                                         
              ctx.lineTo(cur, 0)                                                       
              ctx.lineTo(cur, grid)                                                     
              ctx.lineTo(0, cur)                                                       
              ctx.lineTo(grid, cur)                                                     
              ctx.stroke()                                                             
              if (cur < grid){                                                         
                  rect(ctx, grid, step, cur+step)                                       
              }                                                                         
          }                                                                             
          function draw(grid){                                                         
            var canvas = document.getElementById('bg');                                 
            if (canvas.getContext){                                                     
              var ctx = canvas.getContsext('2d');                                       
              ctx.strokeStyle = '#808080';                                             
              rect(ctx, grid, 20, 20)                                                   
            }                                                                           
          }                                                                             
        </script>                                                                       
        <style type="text/css">                                                         
          canvas { border: 1px solid black; }                                           
        </style>                                                                       
      </head>                                                                           
      <body onload="draw(800);">                                                     
        <canvas id="bg" width="800" height="800"></canvas>       
      </body>                                                                           
    </html>
== Sets ==
<pre>
from random import shuffle
# from itertools import combinations
def combinations(iterable, r):
    pool = tuple(iterable)
    n = len(pool)
    if r > n:
        return
    indices = list(range(r))
    yield tuple(pool[i] for i in indices)
    while True:
        for i in list(range(r))[::-1]:
            if indices[i] != i + n - r:
                break
        else:
            return
        indices[i] += 1
        for j in range(i+1, r):
            indices[j] = indices[j-1] + 1
        yield tuple(pool[i] for i in indices)
def deck():
    r = list(range(3))
    d = [(a,b,c,d) for a in r for b in r for c in r for d in r]
    shuffle(d)
    return d
def deal(d, n):
    if len(d) < n:
        return []
    return [d.pop() for i in range(n)]
def is_set(trio):
    att = lambda x: set(y[x] for y in trio)
    atts = (att(x) for x in range(4))
    return all(len(x) != 2 for x in atts)
def sets(h):
    return [trio for trio in combinations(h, 3) if is_set(trio)]
def pare(h, cards):
    for c in cards:
        h.remove(c)
       
def replace(h, d):
    n = 12 - len(h)
    if n == 0:
        n = 3
    h.extend(deal(d, n))
   
def round(d, h):
    found_sets = sets(h)
    while found_sets:
        first_set = found_sets[0]
        yield first_set
        pare(h, first_set)
        found_sets = sets(h)
    replace(h, d)
def play():
    d = deck()
    h = deal(d, 12)
    found_sets = []
    num_rounds = 0 
    while len(d) > 2:
        num_rounds += 1     
        print("round %d" % num_rounds)
        for x in round(d, h):
            print(x)
            found_sets.append(x)
    print("%d sets found in %d rounds" % (len(found_sets), num_rounds))
   
play()
</pre>
Please note that all contributions to Noisebridge are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Noisebridge:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)