Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] master from avinashkranjan:master #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 59 commits into Uncodedtech:master from avinashkranjan:master
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
bdc8a49
fix: Github_Bomb_Issues/requirements.txt to reduce vulnerabilities
snyk-bot May 20, 2022
4562dd9
build(deps): bump tensorflow-gpu in /Traffic-Sign-Detection
dependabot[bot] May 24, 2022
6589bfc
build(deps): bump tensorflow in /Traffic-Sign-Detection
dependabot[bot] May 24, 2022
1baf621
Merge pull request #1231 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan May 25, 2022
f786aa8
Merge pull request #1230 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan May 25, 2022
bd4ae6c
build(deps): bump tensorflow in /Traffic-Sign-Detection
dependabot[bot] May 26, 2022
94e102c
Merge pull request #1233 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan May 27, 2022
cd8be69
build(deps): bump tensorflow-gpu in /Traffic-Sign-Detection
dependabot[bot] May 27, 2022
7fffc49
Merge pull request #1232 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan May 27, 2022
fec86f9
Update FUNDING.yml
avinashkranjan May 27, 2022
db50b12
fix: Translator-GUI/requirements.txt to reduce vulnerabilities
snyk-bot May 27, 2022
3d62eeb
Merge pull request #1234 from avinashkranjan/snyk-fix-6a7182cb16b671e...
avinashkranjan May 28, 2022
0f34d1c
Merge pull request #1229 from avinashkranjan/snyk-fix-d4da82e9d10e9af...
avinashkranjan May 28, 2022
ef198e6
build(deps): bump notebook in /Traffic-Sign-Detection
dependabot[bot] Jun 17, 2022
12c1f7c
Merge pull request #1235 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan Jun 17, 2022
576a4e2
fix: Calculate-distance/requirements.txt to reduce vulnerabilities
snyk-bot Jul 4, 2022
1d34c0c
fix: Traffic-Sign-Detection/requirements.txt to reduce vulnerabilities
snyk-bot Jul 4, 2022
9b02451
fix: PDFToWord/requirements.txt to reduce vulnerabilities
snyk-bot Jul 6, 2022
d555bb2
fix: Amazon-Price-Alert/requirements.txt to reduce vulnerabilities
snyk-bot Jul 6, 2022
4205798
fix: Internshala-Scraper/requirements.txt to reduce vulnerabilities
snyk-bot Jul 6, 2022
aae0a40
fix: Twitter_Scraper_without_API/requirements.txt to reduce vulnerabi...
snyk-bot Jul 6, 2022
3e89ee5
Merge pull request #1236 from avinashkranjan/snyk-fix-6aead517f6e3dae...
avinashkranjan Jul 13, 2022
89c1323
Merge pull request #1237 from avinashkranjan/snyk-fix-a39229675055f96...
avinashkranjan Jul 13, 2022
d52a835
Merge pull request #1238 from avinashkranjan/snyk-fix-9814a0c4a6241ef...
avinashkranjan Jul 13, 2022
9b20ab4
build(deps): bump numpy in /Heart Disease Prediction
dependabot[bot] Jul 13, 2022
a8f4396
Merge pull request #1239 from avinashkranjan/snyk-fix-5499f3842683498...
avinashkranjan Jul 13, 2022
5098ec6
Merge pull request #1240 from avinashkranjan/snyk-fix-56eda7019d564ed...
avinashkranjan Jul 13, 2022
db89a78
Merge pull request #1241 from avinashkranjan/snyk-fix-078c2874f10901b...
avinashkranjan Jul 13, 2022
ada3fec
build(deps): bump lxml in /Twitter_Scraper_without_API
dependabot[bot] Jul 13, 2022
4f1fcd5
Merge pull request #1244 from avinashkranjan/dependabot/pip/Twitter_S...
avinashkranjan Jul 13, 2022
456d0a2
Merge pull request #1247 from avinashkranjan/dependabot/pip/Heart-Dis...
avinashkranjan Jul 13, 2022
5b91ef6
fix: Calculate-distance/requirements.txt to reduce vulnerabilities
snyk-bot Aug 3, 2022
32f3a32
Merge pull request #1248 from avinashkranjan/snyk-fix-1a410d8c57310fa...
avinashkranjan Aug 4, 2022
9d84529
Added Connect 4 with Minimax algorithm
Arnav-arw Aug 7, 2022
ccccde8
Added readme
Arnav-arw Aug 7, 2022
dab0d14
Added requirements
Arnav-arw Aug 7, 2022
6447550
build(deps): bump nbconvert in /Traffic-Sign-Detection
dependabot[bot] Aug 10, 2022
3d0b995
Merge pull request #1250 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan Aug 11, 2022
cd8c7ab
Merge pull request #1249 from Arnav-arw/master
avinashkranjan Aug 11, 2022
d102feb
build(deps): bump numpy from 1.22.0rc1 to 1.22.0 in /Video-Watermark
dependabot[bot] Aug 23, 2022
212f921
build(deps): bump numpy in /PDF Watermark Remover
dependabot[bot] Aug 23, 2022
359c23e
build(deps): bump numpy in /Traffic-Sign-Detection
dependabot[bot] Aug 23, 2022
23f714c
build(deps): bump numpy in /corona cases forecasting
dependabot[bot] Aug 23, 2022
37550ae
build(deps): bump numpy in /Image_Background_Subtractor
dependabot[bot] Aug 23, 2022
db9f424
build(deps): bump numpy in /Noise Reduction Script
dependabot[bot] Aug 23, 2022
1aad2f6
Merge pull request #1251 from avinashkranjan/dependabot/pip/Video-Wat...
avinashkranjan Aug 23, 2022
65eb0fc
Merge pull request #1252 from avinashkranjan/dependabot/pip/PDF-Water...
avinashkranjan Aug 23, 2022
e258e56
Merge pull request #1253 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan Aug 23, 2022
9527ba3
Merge pull request #1254 from avinashkranjan/dependabot/pip/corona-ca...
avinashkranjan Aug 23, 2022
30d9a2b
Merge pull request #1255 from avinashkranjan/dependabot/pip/Image_Bac...
avinashkranjan Aug 23, 2022
f930636
build(deps): bump numpy from 1.22.0rc1 to 1.22.0 in /Text_Summary
dependabot[bot] Aug 23, 2022
403557d
Merge pull request #1256 from avinashkranjan/dependabot/pip/Noise-Red...
avinashkranjan Aug 23, 2022
9a51bfb
build(deps): bump numpy in /Image Contrast Adjusting Filter
dependabot[bot] Aug 23, 2022
4767b40
Merge pull request #1257 from avinashkranjan/dependabot/pip/Text_Summ...
avinashkranjan Aug 23, 2022
d69a4bb
Merge pull request #1258 from avinashkranjan/dependabot/pip/Image-Con...
avinashkranjan Aug 23, 2022
dabc253
build(deps): bump numpy from 1.22.0rc1 to 1.22.0 in /Neon Effect Filter
dependabot[bot] Aug 23, 2022
8fe682f
Merge pull request #1259 from avinashkranjan/dependabot/pip/Neon-Effe...
avinashkranjan Aug 23, 2022
3a3a75c
build(deps): bump nbconvert in /Traffic-Sign-Detection
dependabot[bot] Aug 23, 2022
696dfae
Merge pull request #1260 from avinashkranjan/dependabot/pip/Traffic-S...
avinashkranjan Aug 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: avinashkranjan
patreon: avinashkranjan
open_collective: # Replace with a single Open Collective username
ko_fi: avinashkranjan
Expand Down
2 changes: 1 addition & 1 deletion Amazon-Price-Alert/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ chardet==3.0.4
cssselect==1.1.0
fake-useragent==0.1.11
idna==2.10
lxml==4.6.5
lxml==4.9.1
parse==1.18.0
pyee==7.0.4
pyppeteer==0.2.2
Expand Down
2 changes: 1 addition & 1 deletion Calculate-distance/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
geopy==2.1.0
folium==0.12.1
django-crispy-forms==1.11.0
Django==2.2.28
Django==3.2.15
10 changes: 10 additions & 0 deletions Connect 4 with Minimax Algorithm/READme.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This is a single player connect 4 game which used [Minimax algorithm](https://en.wikipedia.org/wiki/Minimax).

Dependancies:
1. Pygame 2.1.2
2. Numpy 1.23.1

Game Rules:

Four consecutive balls should match of the same colour horizontally, vertically or diagonally (either of both) just like tic-tac-toe.
That's it now u r ready to play the game :)
287 changes: 287 additions & 0 deletions Connect 4 with Minimax Algorithm/connect4withMiniMax.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
import numpy as np
import random
import pygame
import sys
import math

BLUE = (0,0,255)
BLACK = (0,0,0)
RED = (255,0,0)
YELLOW = (255,255,0)

ROW_COUNT = 6
COLUMN_COUNT = 7

PLAYER = 0
AI = 1

PLAYER_PIECE = 1
AI_PIECE = 2

def createBoard():
board = np.zeros((ROW_COUNT,COLUMN_COUNT))
return board

def dropPiece(board, row, col, piece):
board[row][col] = piece

def isPlaceValid(board, col):
return board[ROW_COUNT-1][col] == 0

def GetNextRow(board, col):
for r in range(ROW_COUNT):
if board[r][col] == 0:
return r

def printBoard(board):
print(np.flip(board, 0))

def winningMove(board, piece):
# Check horizontal locations for win
for c in range(COLUMN_COUNT-3):
for r in range(ROW_COUNT):
if board[r][c] == piece and board[r][c+1] == piece and board[r][c+2] == piece and board[r][c+3] == piece:
return True

# Check vertical locations for win
for c in range(COLUMN_COUNT):
for r in range(ROW_COUNT-3):
if board[r][c] == piece and board[r+1][c] == piece and board[r+2][c] == piece and board[r+3][c] == piece:
return True

# Check positively sloped diaganols
for c in range(COLUMN_COUNT-3):
for r in range(ROW_COUNT-3):
if board[r][c] == piece and board[r+1][c+1] == piece and board[r+2][c+2] == piece and board[r+3][c+3] == piece:
return True

# Check negatively sloped diaganols
for c in range(COLUMN_COUNT-3):
for r in range(3, ROW_COUNT):
if board[r][c] == piece and board[r-1][c+1] == piece and board[r-2][c+2] == piece and board[r-3][c+3] == piece:
return True

def scoringScorePosition(selectedGroup, piece):
score = 0
opp_piece = PLAYER_PIECE
if piece == PLAYER_PIECE:
opp_piece = AI_PIECE

if selectedGroup.count(piece) == 4:
score += 100
elif selectedGroup.count(piece) == 3 and selectedGroup.count(0) == 1:
score += 5
elif selectedGroup.count(piece) == 2 and selectedGroup.count(0) == 2:
score += 2

if selectedGroup.count(opp_piece) == 3 and selectedGroup.count(0) == 1:
score -= 4

return score

def scorePosition(board, piece):
score = 0

## Score center column
center_array = [int(i) for i in list(board[:, COLUMN_COUNT//2])]
center_count = center_array.count(piece)
score += center_count * 3

## Score Horizontal
for r in range(ROW_COUNT):
row_array = [int(i) for i in list(board[r,:])]
for c in range(COLUMN_COUNT-3):
selectedGroup = row_array[c:c+4]
score += scoringScorePosition(selectedGroup, piece)

## Score Vertical
for c in range(COLUMN_COUNT):
col_array = [int(i) for i in list(board[:,c])]
for r in range(ROW_COUNT-3):
selectedGroup = col_array[r:r+4]
score += scoringScorePosition(selectedGroup, piece)

## Score posiive sloped diagonal
for r in range(ROW_COUNT-3):
for c in range(COLUMN_COUNT-3):
selectedGroup = [board[r+i][c+i] for i in range(4)]
score += scoringScorePosition(selectedGroup, piece)

for r in range(ROW_COUNT-3):
for c in range(COLUMN_COUNT-3):
selectedGroup = [board[r+3-i][c+i] for i in range(4)]
score += scoringScorePosition(selectedGroup, piece)

return score

def isTerminalNode(board):
return winningMove(board, PLAYER_PIECE) or winningMove(board, AI_PIECE) or len(getValidLocations(board)) == 0

def minimax(board, depth, alpha, beta, maximizingPlayer):
validLocations = getValidLocations(board)
isTerminal = isTerminalNode(board)
if depth == 0 or isTerminal:
if isTerminal:
if winningMove(board, AI_PIECE):
return (None, 100000000000000)
elif winningMove(board, PLAYER_PIECE):
return (None, -10000000000000)
else: # Game is over, no more valid moves
return (None, 0)
else: # Depth is zero
return (None, scorePosition(board, AI_PIECE))
if maximizingPlayer:
value = -math.inf
column = random.choice(validLocations)
for col in validLocations:
row = GetNextRow(board, col)
b_copy = board.copy()
dropPiece(b_copy, row, col, AI_PIECE)
new_score = minimax(b_copy, depth-1, alpha, beta, False)[1]
if new_score > value:
value = new_score
column = col
alpha = max(alpha, value)
if alpha >= beta:
break
return column, value

else: # Minimizing player
value = math.inf
column = random.choice(validLocations)
for col in validLocations:
row = GetNextRow(board, col)
b_copy = board.copy()
dropPiece(b_copy, row, col, PLAYER_PIECE)
new_score = minimax(b_copy, depth-1, alpha, beta, True)[1]
if new_score < value:
value = new_score
column = col
beta = min(beta, value)
if alpha >= beta:
break
return column, value

def getValidLocations(board):
validLocations = []
for col in range(COLUMN_COUNT):
if isPlaceValid(board, col):
validLocations.append(col)
return validLocations

def bestMoveForAI(board, piece):

validLocations = getValidLocations(board)
bestScore = -10000
bestMove = random.choice(validLocations)
for col in validLocations:
row = GetNextRow(board, col)
temp_board = board.copy()
dropPiece(temp_board, row, col, piece)
score = scorePosition(temp_board, piece)
if score > bestScore:
bestScore = score
bestMove = col

return bestMove

def drawBoard(board):
for c in range(COLUMN_COUNT):
for r in range(ROW_COUNT):
pygame.draw.rect(screen, BLUE, (c*SQUARESIZE, r*SQUARESIZE+SQUARESIZE, SQUARESIZE, SQUARESIZE))
pygame.draw.circle(screen, BLACK, (int(c*SQUARESIZE+SQUARESIZE/2), int(r*SQUARESIZE+SQUARESIZE+SQUARESIZE/2)), RADIUS)

for c in range(COLUMN_COUNT):
for r in range(ROW_COUNT):
if board[r][c] == PLAYER_PIECE:
pygame.draw.circle(screen, RED, (int(c*SQUARESIZE+SQUARESIZE/2), height-int(r*SQUARESIZE+SQUARESIZE/2)), RADIUS)
elif board[r][c] == AI_PIECE:
pygame.draw.circle(screen, YELLOW, (int(c*SQUARESIZE+SQUARESIZE/2), height-int(r*SQUARESIZE+SQUARESIZE/2)), RADIUS)
pygame.display.update()

board = createBoard()
printBoard(board)
isGameOver = False

pygame.init()

SQUARESIZE = 100

width = COLUMN_COUNT * SQUARESIZE
height = (ROW_COUNT+1) * SQUARESIZE

size = (width, height)

RADIUS = int(SQUARESIZE/2 - 5)

screen = pygame.display.set_mode(size)
drawBoard(board)
pygame.display.update()
pygame.display.set_caption('Connect 4')
myfont = pygame.font.SysFont("monospace", 75)

turn = random.randint(PLAYER, AI)

while not isGameOver:

for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()

if event.type == pygame.MOUSEMOTION:
pygame.draw.rect(screen, BLACK, (0,0, width, SQUARESIZE))
posx = event.pos[0]
if turn == PLAYER:
pygame.draw.circle(screen, RED, (posx, int(SQUARESIZE/2)), RADIUS)

pygame.display.update()

if event.type == pygame.MOUSEBUTTONDOWN:
pygame.draw.rect(screen, BLACK, (0,0, width, SQUARESIZE))
#print(event.pos)
# Ask for Player 1 Input
if turn == PLAYER:
posx = event.pos[0]
col = int(math.floor(posx/SQUARESIZE))

if isPlaceValid(board, col):
row = GetNextRow(board, col)
dropPiece(board, row, col, PLAYER_PIECE)

if winningMove(board, PLAYER_PIECE):
label = myfont.render("Player 1 win!!", 1, RED)
screen.blit(label, (40,10))
isGameOver = True

turn += 1
turn = turn % 2

printBoard(board)
drawBoard(board)


# # Ask for Player 2 Input
if turn == AI and not isGameOver:

#col = random.randint(0, COLUMN_COUNT-1)
#col = bestMoveForAI(board, AI_PIECE)
col, minimax_score = minimax(board, 5, -math.inf, math.inf, True)

if isPlaceValid(board, col):
#pygame.time.wait(500)
row = GetNextRow(board, col)
dropPiece(board, row, col, AI_PIECE)

if winningMove(board, AI_PIECE):
label = myfont.render("Player 2 wins!!", 1, YELLOW)
screen.blit(label, (40,10))
isGameOver = True

printBoard(board)
drawBoard(board)

turn += 1
turn = turn % 2

if isGameOver:
pygame.time.wait(5000)
2 changes: 2 additions & 0 deletions Connect 4 with Minimax Algorithm/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pygame == 2.1.2
numpy = 1.23.1
1 change: 1 addition & 0 deletions Github_Bomb_Issues/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ PyGithub
requests
os
getpass
pyjwt>=2.4.0 # not directly required, pinned by Snyk to avoid a vulnerability
2 changes: 1 addition & 1 deletion Heart Disease Prediction/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy==1.18.5
numpy==1.22.0
pandas @ file:///C:/ci/pandas_1592833613419/work
scikit-learn @ file:///C:/ci/scikit-learn_1592853510272/work
2 changes: 1 addition & 1 deletion Image Contrast Adjusting Filter/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy==1.22.0rc1
numpy==1.22.0
matplotlib==3.2.2
Pillow==9.0.1
2 changes: 1 addition & 1 deletion Image_Background_Subtractor/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy==1.22.0rc1
numpy==1.22.0
opencv-python==4.5.1.48
2 changes: 1 addition & 1 deletion Internshala-Scraper/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ bs4==0.0.1
certifi==2020年6月20日
chardet==3.0.4
idna==2.10
lxml==4.6.5
lxml==4.9.1
requests==2.24.0
soupsieve==2.0.1
urllib3==1.25.10
2 changes: 1 addition & 1 deletion Neon Effect Filter/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy==1.22.0rc1
numpy==1.22.0
opencv_python==4.5.1.48
matplotlib==3.2.2
2 changes: 1 addition & 1 deletion Noise Reduction Script/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
matplotlib==3.2.2
numpy==1.22.0rc1
numpy==1.22.0
scipy==1.5.0
2 changes: 1 addition & 1 deletion PDF Watermark Remover/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
scikit_image==0.18.1
pdf2image==1.15.1
fpdf==1.7.2
numpy==1.22.0rc1
numpy==1.22.0
Pillow==9.0.1
PyPDF2==1.27.5
skimage==0.0
2 changes: 1 addition & 1 deletion PDFToWord/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fire==0.4.0
lxml==4.6.5
lxml==4.9.1
pdf2docx==0.5.1
PyMuPDF==1.18.12
python-docx==0.8.10
Expand Down
2 changes: 1 addition & 1 deletion Text_Summary/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nltk==3.6.6
numpy==1.22.0rc1
numpy==1.22.0
networkx==2.5
Loading

AltStyle によって変換されたページ (->オリジナル) /