Skip to content

Instantly share code, notes, and snippets.

@foldi
Created Oct 4, 2013
Embed
What would you like to do?
Magic regex
colors = {
empty: 0,
brown: 1,
green: 2,
blue: 3,
cyan: 4,
magenta: 5,
yellow: 6,
black: 7,
gray: 8
};
items = {
2: {
'/^[^0-9]*7[^0-9]*1[^0-9]*$/': 'torch'
},
3: {
'/^[^0-9]*3[^0-9]*3[^0-9]*1[^0-9]*$/': 'wooden sword',
'/^[^0-9]*4[^0-9]*1[^0-9]*5[^0-9]*$/': 'arrow',
'/^[-]*222[-]*$/gm': 'paper'
},
5: {
'/^[^0-9]*666[^0-9]*1[^0-9]*1[^0-9]*$/': 'gold pickaxe',
'/^[^0-9]*88[^0-9]*81[^0-9]*1[^0-9]*$/': 'iron axe'
},
8: {
'/^[^0-9]*333[^0-9]*3[^0-9]*3[^0-9]*333[^0-9]*$/': 'chest'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment