This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
bomb_count = [] | |
revealed = [] | |
BOMB_CHANCE = 0.3 | |
BOMB = '*' | |
def reveal(px, py): | |
global revealed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def realTotal(player): | |
return min((21 - player[0]) / 10, player[1]) * 10 + player[0] | |
def moneyInput(prompt): | |
while True: | |
try: | |
ret = float(input(prompt)) | |
if ret < 0: | |
raise ValueError | |
else: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTE: This file is used to name the gist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NOTE: This file is used to name the gist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Evaluates a math expression with the correct order of operations. """ | |
def editExpression(inputExpr): | |
""" Edit the math expression by removing spaces and enclosing it in parentheses. """ | |
expression = "(" | |
for ch in inputExpr: | |
if ch != ' ': | |
expression += ch | |
expression += ')' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <utility> | |
using namespace std; | |
// Arrays and macros | |
#define SIDE_LEN 9 | |
bool rows[SIDE_LEN][SIDE_LEN] = {false}; | |
bool cols[SIDE_LEN][SIDE_LEN] = {false}; | |
bool boxes[SIDE_LEN][SIDE_LEN] = {false}; | |
#define BLANK 0 |