Skip to content

Commit 7f017a8

Browse files
Merge branch 'geekcomputers:master' into master
2 parents 1296abf + 495e254 commit 7f017a8

File tree

192 files changed

+6534
-1479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+6534
-1479
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This workflow will trigger Datadog Synthetic tests within your Datadog organisation
2+
# For more information on running Synthetic tests within your GitHub workflows see: https://docs.datadoghq.com/synthetics/cicd_integrations/github_actions/
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
# To get started:
10+
11+
# 1. Add your Datadog API (DD_API_KEY) and Application Key (DD_APP_KEY) as secrets to your GitHub repository. For more information, see: https://docs.datadoghq.com/account_management/api-app-keys/.
12+
# 2. Start using the action within your workflow
13+
14+
name: Run Datadog Synthetic tests
15+
16+
on:
17+
push:
18+
branches: [ "master" ]
19+
pull_request:
20+
branches: [ "master" ]
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
# Run Synthetic tests within your GitHub workflow.
30+
# For additional configuration options visit the action within the marketplace: https://github.com/marketplace/actions/datadog-synthetics-ci
31+
- name: Run Datadog Synthetic tests
32+
uses: DataDog/synthetics-ci-github-action@87b505388a22005bb8013481e3f73a367b9a53eb # v1.4.0
33+
with:
34+
api_key: ${{secrets.DD_API_KEY}}
35+
app_key: ${{secrets.DD_APP_KEY}}
36+
test_search_query: 'tag:e2e-tests' #Modify this tag to suit your tagging strategy
37+
38+

.github/workflows/lint_python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: lint_python
1+
name: python
22
on: [pull_request, push]
33
jobs:
44
lint_python:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ for i in string:
1616
odd+=i
1717
print(lower+upper+odd+even)
1818

19+
.venv
1920
# operating system-related files
2021

2122
# file properties cache/storage on macOS
2223
*.DS_Store
2324

2425
# thumbnail cache on Windows
2526
Thumbs.db
27+
bankmanaging.db

.vscode/c_cpp_properties.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "windows-gcc-x64",
5+
"includePath": [
6+
"${workspaceFolder}/**"
7+
],
8+
"compilerPath": "gcc",
9+
"cStandard": "${default}",
10+
"cppStandard": "${default}",
11+
"intelliSenseMode": "windows-gcc-x64",
12+
"compilerArgs": [
13+
""
14+
]
15+
}
16+
],
17+
"version": 4
18+
}

.vscode/launch.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "C/C++ Runner: Debug Session",
6+
"type": "cppdbg",
7+
"request": "launch",
8+
"args": [],
9+
"stopAtEntry": false,
10+
"externalConsole": true,
11+
"cwd": "c:/Users/prave/python_examples/geekcomputers",
12+
"program": "c:/Users/prave/python_examples/geekcomputers/build/Debug/outDebug",
13+
"MIMode": "gdb",
14+
"miDebuggerPath": "gdb",
15+
"setupCommands": [
16+
{
17+
"description": "Enable pretty-printing for gdb",
18+
"text": "-enable-pretty-printing",
19+
"ignoreFailures": true
20+
}
21+
]
22+
}
23+
]
24+
}

.vscode/settings.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"C_Cpp_Runner.cCompilerPath": "gcc",
3+
"C_Cpp_Runner.cppCompilerPath": "g++",
4+
"C_Cpp_Runner.debuggerPath": "gdb",
5+
"C_Cpp_Runner.cStandard": "",
6+
"C_Cpp_Runner.cppStandard": "",
7+
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
8+
"C_Cpp_Runner.useMsvc": false,
9+
"C_Cpp_Runner.warnings": [
10+
"-Wall",
11+
"-Wextra",
12+
"-Wpedantic",
13+
"-Wshadow",
14+
"-Wformat=2",
15+
"-Wcast-align",
16+
"-Wconversion",
17+
"-Wsign-conversion",
18+
"-Wnull-dereference"
19+
],
20+
"C_Cpp_Runner.msvcWarnings": [
21+
"/W4",
22+
"/permissive-",
23+
"/w14242",
24+
"/w14287",
25+
"/w14296",
26+
"/w14311",
27+
"/w14826",
28+
"/w44062",
29+
"/w44242",
30+
"/w14905",
31+
"/w14906",
32+
"/w14263",
33+
"/w44265",
34+
"/w14928"
35+
],
36+
"C_Cpp_Runner.enableWarnings": true,
37+
"C_Cpp_Runner.warningsAsError": false,
38+
"C_Cpp_Runner.compilerArgs": [],
39+
"C_Cpp_Runner.linkerArgs": [],
40+
"C_Cpp_Runner.includePaths": [],
41+
"C_Cpp_Runner.includeSearch": [
42+
"*",
43+
"**/*"
44+
],
45+
"C_Cpp_Runner.excludeSearch": [
46+
"**/build",
47+
"**/build/**",
48+
"**/.*",
49+
"**/.*/**",
50+
"**/.vscode",
51+
"**/.vscode/**"
52+
],
53+
"C_Cpp_Runner.useAddressSanitizer": false,
54+
"C_Cpp_Runner.useUndefinedSanitizer": false,
55+
"C_Cpp_Runner.useLeakSanitizer": false,
56+
"C_Cpp_Runner.showCompilationTime": false,
57+
"C_Cpp_Runner.useLinkTimeOptimization": false,
58+
"C_Cpp_Runner.msvcSecureNoWarnings": false
59+
}

1 File handle/File handle text/question 5.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Write a function in python to count the number of lowercase
22
alphabets present in a text file “happy.txt"""
33

4-
import time, os
4+
import time
5+
import os
56
from counter import Counter
67

78
print("You will see the count of lowercase, uppercase and total count of alphabets in provided file..")

1 File handle/File handle text/question 6.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Write a function in python to count the number of lowercase
2-
alphabets present in a text file “happy.txt"""
2+
alphabets present in a text file “happy.txt"""
33

44
from counter import Counter
55

8_puzzle.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
from queue import PriorityQueue
2+
3+
class PuzzleState:
4+
def __init__(self, board, goal, moves=0, previous=None):
5+
self.board = board
6+
self.goal = goal
7+
self.moves = moves
8+
self.previous = previous
9+
10+
def __lt__(self, other):
11+
return self.priority() < other.priority()
12+
13+
def priority(self):
14+
return self.moves + self.manhattan()
15+
16+
def manhattan(self):
17+
distance = 0
18+
for i in range(3):
19+
for j in range(3):
20+
if self.board[i][j] != 0:
21+
x, y = divmod(self.board[i][j] - 1, 3)
22+
distance += abs(x - i) + abs(y - j)
23+
return distance
24+
25+
def is_goal(self):
26+
return self.board == self.goal
27+
28+
def neighbors(self):
29+
neighbors = []
30+
x, y = next((i, j) for i in range(3) for j in range(3) if self.board[i][j] == 0)
31+
directions = [(-1, 0), (1, 0), (0, -1), (0, 1)]
32+
33+
for dx, dy in directions:
34+
nx, ny = x + dx, y + dy
35+
if 0 <= nx < 3 and 0 <= ny < 3:
36+
new_board = [row[:] for row in self.board]
37+
new_board[x][y], new_board[nx][ny] = new_board[nx][ny], new_board[x][y]
38+
neighbors.append(PuzzleState(new_board, self.goal, self.moves + 1, self))
39+
40+
return neighbors
41+
42+
def solve_puzzle(initial_board, goal_board):
43+
initial_state = PuzzleState(initial_board, goal_board)
44+
frontier = PriorityQueue()
45+
frontier.put(initial_state)
46+
explored = set()
47+
48+
while not frontier.empty():
49+
current_state = frontier.get()
50+
51+
if current_state.is_goal():
52+
return current_state
53+
54+
explored.add(tuple(map(tuple, current_state.board)))
55+
56+
for neighbor in current_state.neighbors():
57+
if tuple(map(tuple, neighbor.board)) not in explored:
58+
frontier.put(neighbor)
59+
60+
return None
61+
62+
def print_solution(solution):
63+
steps = []
64+
while solution:
65+
steps.append(solution.board)
66+
solution = solution.previous
67+
steps.reverse()
68+
69+
for step in steps:
70+
for row in step:
71+
print(' '.join(map(str, row)))
72+
print()
73+
74+
# Example usage
75+
initial_board = [
76+
[1, 2, 3],
77+
[4, 0, 5],
78+
[7, 8, 6]
79+
]
80+
81+
goal_board = [
82+
[1, 2, 3],
83+
[4, 5, 6],
84+
[7, 8, 0]
85+
]
86+
87+
solution = solve_puzzle(initial_board, goal_board)
88+
if solution:
89+
print("Solution found:")
90+
print_solution(solution)
91+
else:
92+
print("No solution found.")

AI Game/Tic-Tac-Toe-AI/tic tac

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)