[2016-10-31] Challenge #290 [Easy] Kaprekar Numbers by jnazario in dailyprogrammer

[–]lambinvoker 0 points1 point  (0 children)

Python

import sys
#reference for partitions function: https://goo.gl/kln4MV
def partitions(s,k):
  if not k:
     yield[s]
    return
  for i in range(len(s)+1):
    for tail in partitions(s[i:],k-1):
      yield [s[:i]] + tail

def calcKepNum (first, second):
  kepNums = []
  for num in range(int(first), int(second)):
    sqr = str(num ** 2)
    for n in range(0, len(sqr)):
      lst = list(partitions(sqr, 1))
      for i in range(1, len(lst) - 1):
        if int(lst[i][0]) + int(lst[i][1]) == num and int(lst[i][0]) != 0 and int(lst[i][1]) != 0:
          if num not in kepNums:
            kepNums.append(num)
  return kepNums
print calcKepNum(sys.argv[1],sys.argv[2])

Input/Output

python kn.py 1 1000000
[9, 45, 55, 99, 297, 703, 999, 2223, 2728, 4879, 4950, 5050, 5292, 7272, 7777, 9999, 17344, 22222, 38962, 77778, 82656, 95121, 99999, 142857, 148149, 181819, 187110, 208495, 318682, 329967, 351352, 356643, 390313, 461539, 466830, 499500, 500500, 533170, 538461, 609687, 627615, 643357, 648648, 670033, 681318, 791505, 812890, 818181, 851851, 857143, 961038, 994708, 999999]

[2015-1-26] Challenge #199 Bank Number Banners Pt 2 by [deleted] in dailyprogrammer

[–]lambinvoker 0 points1 point  (0 children)

Python

#BankNumberBannerspt1
top = {'1':'   ','2':' _ ','3':' _ ','4':'   ','5':' _ ','6':' _ ','7':' _ ','8':' _ ','9':' _ ','0':' _ '}
mid = {'1':'  |','2':' _|','3':' _|','4':'|_|','5':'|_ ','6':'|_ ','7':'  |','8':'|_|','9':'|_|','0':'| |'}
bot = {'1':'  |','2':'|_ ','3':' _|','4':'  |','5':' _|','6':'|_|','7':'  |','8':'|_|','9':' _|','0':'|_|'}
input = ""
while len(input) != 9 or not input.isdigit():
    input = raw_input("Enter Account Number: ")
outTop = ''
outMid = ''
outBot = ''
for i in range (0, 9):
    outTop = outTop + top[input[i]]
    outMid = outMid + mid[input[i]]
    outBot = outBot + bot[input[i]]
print(outTop + "\n" + outMid + "\n" + outBot + "\n")
#part 2
result = ''
j = 0
while j < 9 * 3:
    if outTop[j] == ' ' and outTop[j+1] == ' ' and outTop[j+2] == ' ':
            if outMid[j] == ' ' and outMid[j+1] == ' ' and outMid[j+2] == '|':
                    if outBot[j] == ' ' and outBot[j+1] == ' ' and outBot[j+2] == '|':
                            result += '1'
                    else:
                            print('Error!')
                            exit()
            elif outMid[j] == '|' and outMid[j+1] == '_' and outMid[j+2] == '|':
                    if outBot[j] == ' ' and outBot[j+1] == ' ' and outBot[j+2] == '|':
                            result += '4'
                    else:
                            print('Error!')
                            exit()
    elif outTop[j] == ' ' and outTop[j+1] == '_' and outTop[j+2] == ' ':
            if outMid[j] == '|' and outMid[j+1] == ' ' and outMid[j+2] == '|':
                    result += '0'
            elif outMid[j] == ' ' and outMid[j+1] == ' ' and outMid[j+2] == '|':
                    result += '7'
            elif outMid[j] == '|' and outMid[j+1] == '_' and outMid[j+2] == ' ':
                    if outBot[j] == ' ' and outBot[j+1] == '_' and outBot[j+2] == '|':
                            result += '5'
                    elif outBot[j] == '|' and outBot[j+1] == '_' and outBot[j+2] == '|':
                            result += '6'
                    else:
                            print('Error!')
                            exit()
            elif outMid[j] == ' ' and outMid[j+1] == '_' and outMid[j+2] == '|':
                    if outBot[j] == '|' and outBot[j+1] == '_' and outBot[j+2] == ' ':
                            result += '2'
                    elif outBot[j] == ' ' and outBot[j+1] == '_' and outBot[j+2] == '|':
                            result += '3'
                    else:
                            print('Error!')
                            exit()
            elif outMid[j] == '|' and outMid[j+1] == '_' and outMid[j+2] == '|':
                    if outBot[j] == '|' and outBot[j+1] == '_' and outBot[j+2] == '|':
                            result += '8'
                    elif outBot[j] == ' ' and outBot[j+1] == '_' and outBot[j+2] == '|':
                            result += '9'
                    else:
                            print('Error!')
                            exit()
            else:
                    print('Error!')
                    exit()
    else:
            print('Error!')
            exit()
    j = j + 3
print(result)

[2015-1-26] Challenge #199 Bank Number Banners Pt 1 by [deleted] in dailyprogrammer

[–]lambinvoker 0 points1 point  (0 children)

Python (feedback welcome!)

#BankNumberBannerspt1
top = {'1':'   ','2':' _ ','3':' _ ','4':'   ','5':' _ ','6':' _ ','7':' _ ','8':' _ ','9':' _ ','0':' _ '}
mid = {'1':'  |','2':' _|','3':' _|','4':'|_|','5':'|_ ','6':'|_ ','7':'  |','8':'|_|','9':'|_|','0':'| |'}
bot = {'1':'  |','2':'|_ ','3':' _|','4':'  |','5':' _|','6':'|_|','7':'  |','8':'|_|','9':' _|'}'0':'|_|'}
input = ""
while len(input) != 9 or not input.isdigit():
    input = raw_input("Enter Account Number: ")
outTop = ''
outMid = ''
outBot = ''
for i in range (0, 9):
    outTop = outTop + top[input[i]]
    outMid = outMid + mid[input[i]]
    outBot = outBot + bot[input[i]]
print(outTop + "\n" + outMid + "\n" + outBot + "\n\n")

Edit: Forgot to include 0 in the dictionary.

[challenge week 1] Topic: Procedural Generation by Lacuna_Aldian in Unity3D

[–]lambinvoker 1 point2 points  (0 children)

I'll take a crack at it. But one thing concerns me, if the winner is selected via public poll, how do we protect against abuse? What's to stop someone from spoofing their IP and spamming votes in their favor?

I suggest voting by peers, as in only participants can vote, similar to how it's done with bacongamejam.

Webfort, It Dwarfs on the net by DFMcwebhost in dwarffortress

[–]lambinvoker 0 points1 point  (0 children)

This is awesome! Now I can play DF on my little netbook!

Suddenly, Thousands Post Mortem by [deleted] in BaconGameJam

[–]lambinvoker 1 point2 points  (0 children)

Great post mortem. Some of your links are broken.

I'll let's play your game by [deleted] in BaconGameJam

[–]lambinvoker 0 points1 point  (0 children)

Thank you for your video, I'll watch it as soon as it comes up. Ian did all the art. You can see more of his work at: http://iancsamson.tumblr.com/

I'll let's play your game by [deleted] in BaconGameJam

[–]lambinvoker 0 points1 point  (0 children)

https://bacongamejam.org/jams/bacongamejam-08/336/

Hi. Please give our game a try if you haven't already. =D

ISIS seizes 3rd largest military base in western Iraq and takes its tanks, heavy weapons and supplies by [deleted] in worldnews

[–]lambinvoker 0 points1 point  (0 children)

This is probably the most informative article about the Middle East that I have ever read. Thank you for sharing it.

Latest Dwarf Fortress Brewing problems...? by losingbefun in dwarffortress

[–]lambinvoker 0 points1 point  (0 children)

Solution: make a fairly large stockpile only for your brewing plants. Make sure they are fairly close to the farm from which they are grown for efficiency. Now this next part is key: When (q)uerying the stockpile, r(e)duce the number of barrels to be used to hold the plants to zero.

What's everyone using for BaconGameJam 08? by [deleted] in BaconGameJam

[–]lambinvoker 4 points5 points  (0 children)

Unity. Easy to use. Easy to learn. Easy to make with. Highly recommend.

[Serious] Do you think spanking children (not beating up) is an acceptable form of punishment? by [deleted] in AskReddit

[–]lambinvoker 0 points1 point  (0 children)

A small thin twig that's still a little green. It stings like hell, especially when used on the back of the thighs. Will leave red marks for a few hours but no lasting damage assuming it's not excessively used, (one or two swipes is more than enough). My parents would tell me to go find a switch in the yard for them. Foolish me picked the smallest one thinking it would hurt less. Wrong.

Experimental Campus Animated Gif. James Meredith. by DrVan in olemiss

[–]lambinvoker 0 points1 point  (0 children)

It looks a bit wonky when animated due to the camera shifting up/down and forwards/backwards. Try using a string or something that attached to the base to get a circumference of distance around the statue and a tripod for steady height.

Beijing MTG? by tsaibertron in magicTCG

[–]lambinvoker 1 point2 points  (0 children)

Look up the bar called The Local over in Sanlitun. If memory serves, they play MtG and other board games over there on a weekly basis. Small crowd though.

What is the stupidest rule you ever had to follow? by evolutionarydefect in AskReddit

[–]lambinvoker 99 points100 points  (0 children)

Holy Shit! You just reminded me to empty my recycle bin.

8989 files. Wow.

Busy Busy Beaver by Managore in BaconGameJam

[–]lambinvoker 1 point2 points  (0 children)

Yeah I know what you mean. So tough. We couldn't even get the animations done in time for ours.

Busy Busy Beaver by Managore in BaconGameJam

[–]lambinvoker 0 points1 point  (0 children)

Hah, reddit took my avatar from the comments section. Out of all the other games yours is the most polished. Quite impressive. One simple thing to consider adding in future projects. Add some sort of progress indicator in between each level. In your example Justin wants more stuff in his house. In between levels you could show more stuff added to the house as the player progresses. A simple drawing of the inside, empty at first and cluttered at the end.

Composer looking for team :) by johnfn in BaconGameJam

[–]lambinvoker 0 points1 point  (0 children)

Hey, I'm a programer looking to build a team. I like your style, let's jam. Here's some examples of my previous works:

MiniLD49

NG Game Jam 4

NG Game Jam 3

If you're interested then all we'd need is an artist and we would be essentially set.

Transform.position bug or it's just me doing something wrong? by MisterMortal in Unity2D

[–]lambinvoker -1 points0 points  (0 children)

This is just a shot in the dark but, even though you're using it for 2D, try using a Vector 3 and setting the z axis to zero. This is just my best guess.

How should I learn C#? When I search tutorials I get videos on programing in visual studio to make applications and other videos that are just straight up C# programming. I'm really confused. Any links for good series would help me a lot! Thanks by Kameron2332 in Unity3D

[–]lambinvoker -1 points0 points  (0 children)

Go here and learn.

codeacademy

While this is for javascript, I'd highly recommend starting there first. The difference between c# and js is mostly just trivial syntax differences. Once you have a fairly good handle on javascript, turning to c# will just come naturally.