Skip to content

Instantly share code, notes, and snippets.

View Ropes's full-sized avatar

Josh Roppo Ropes

View GitHub Profile
@Ropes
Ropes / palindrome.py
Created May 9, 2014 20:38
Palindrome Check
from __future__ import print_function, unicode_literals
def iter_palindrome(string):
'''Memory efficient but unelegant iterative solution.
Starting at each end of the string comapre characters until the center
is reached or iterators overlap if it's semetric
'''
print(string)
i = 0
j = len(string) - 1
@Ropes
Ropes / beancount.py
Last active December 22, 2015 19:29
Bohnanza max score calculation. If I understand the game rules correctly, I think I've fixed the mistakes.
from __future__ import print_function, unicode_literals
bean_types = {
'coffee': (24, [4, 7, 10, 12]),
'wax': (22, [4, 7, 9, 11]),
'blue': (20, [4, 6, 8, 10]),
'chili': (18, [3, 6, 8, 9]),
'stink': (16, [3, 5, 7, 8]),
'green': (14, [3, 5, 6, 7]),
'soy': (12, [2, 4, 6, 7]),