Skip to content

Instantly share code, notes, and snippets.

import os
import numpy as np
from sklearn.metrics import log_loss
"""
- HARDCODED FORMULAE
- In this gist, we shall almost always use probabilities and not unscaled logits
"""
## BINARY CLASS CROSS ENTROPY
y_true = [0,0,0,1] # 4 observations
@simrit1
simrit1 / tictactoe.py
Created March 28, 2022 07:12 — forked from hdorothea/tictactoe.py
A simple tic-tac-toe game in Python
import itertools
class Board(object):
def __init__(self):
self.rows = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']]
@property
def diagonals(self):
@simrit1
simrit1 / tictactoe.py
Created March 28, 2022 07:06 — forked from jamesshah/tictactoe.py
TicTacToe Game implemented in python3
#Implementation of Two Player Tic-Tac-Toe game in Python.
''' We will make the board using dictionary
in which keys will be the location(i.e : top-left,mid-right,etc.)
and initialliy it's values will be empty space and then after every move
we will change the value according to player's choice of move. '''
theBoard = {'7': ' ' , '8': ' ' , '9': ' ' ,
'4': ' ' , '5': ' ' , '6': ' ' ,
'1': ' ' , '2': ' ' , '3': ' ' }
@simrit1
simrit1 / Tix-tac-toe
Created March 28, 2022 07:05 — forked from pgaijin66/Tix-tac-toe
simple Tic tac toe game made in python
def display_board(board):
for i in range(3):
print " ",
for j in range(3):
if board[i*3+j] == 1:
print 'X',
elif board[i*3+j] == 0:
@simrit1
simrit1 / tictactoe.py
Created March 28, 2022 07:03 — forked from eaorak/tictactoe.py
Python - TicTacToe Game
#!/usr/bin/python3
# Simple TicTacToe game in Python - EAO
import random
import sys
board=[i for i in range(0,9)]
player, computer = '',''
# Corners, Center and Others, respectively
moves=((1,7,3,9),(5,),(2,4,6,8))
@simrit1
simrit1 / simpleLP1.py
Created March 24, 2022 18:38 — forked from vinovator/simpleLP1.py
Python script to solve Linear Programming problems using PuLP library
# simpleLP1.py
# Python 2.7.6
"""
Python script to solve Linear Programming problems
Uses Pulp library
Problem statement: (src - http://fisher.osu.edu/~croxton.4/tutorial/)
1) Objective Function -
@simrit1
simrit1 / RPS.py
Created March 24, 2022 18:19 — forked from evanwike/RPS.py
Rock, Paper, Scissors! w/ VS. Computer and Multiplayer - Also keeps score (Python)
import random
def rps(n,x,y):
print('-----------------------')
print('Rock, Paper, Scissors!!')
mode = int(input('(1) Vs. Computer (2) Multiplayer'))
if mode == 1:
print('Wins: ' + str(n))
user = str(input('Rock (R/r), Paper (P/p) or Scissors (S/s)?')).lower()
import random
score = 0
choice = ["rock","scissors","paper"]
x = random.choice(choice)
def rockpaperscissors():
print(score)
user1 = input("Choose rock, scissors or paper")
if (x == "rock" and user1 == "rock") or (x == "paper" and user1 == "paper") or (x == "scissors" and user1 == "scissors"):
print ("tie")
# This program is a simulation of the spread of Covid-19 in a country.
print("This Program is dedicated to a project i did back in 2020 for a Challenge called the 300 Innovation Challenge")
# Asking the user to input the number of people who have Covid in their country.
cases=int(input("How many people have Covid in your country"))
# Creating a list of the number of cases for each day.
future=[cases]
# This code is taking the number of cases on a given day and multiplying it by a factor of 2.5.
if cases<30000:
for x in range(0,50):
print("day",x,"cases",future[x])