Skip to content

Commit

Permalink
Merge branch 'kunjgit:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
taneeshaa15 authored Jun 11, 2024
2 parents 32e08e8 + 40deec1 commit cb1b0f4
Show file tree
Hide file tree
Showing 125 changed files with 7,120 additions and 279 deletions.
432 changes: 216 additions & 216 deletions .github/workflows/pr_check.yml

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions .github/workflows/restrict_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Restrict Contributor to limited contributions in GameZone

on:
pull_request_target:
types:
- opened

jobs:
evaluate_and_close:
runs-on: ubuntu-latest

steps:
- name: Check merged pull requests and calculate score
id: calculate_score
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullRequestOpener = context.payload.pull_request.user.login;
let mergedPullRequests = [];
let page = 1;
let perPage = 100;
let response;
do {
response = await github.pulls.list({
owner,
repo,
state: 'closed',
per_page: perPage,
page: page
});
mergedPullRequests = mergedPullRequests.concat(response.data.filter(pr => pr.user.login === pullRequestOpener && pr.merged_at !== null));
page++;
} while (response.data.length === perPage);
let score = 0;
let prDetails = [];
const scoreMap = {
'level3': 45,
'level2': 25,
'level1': 10
};
for (const pr of mergedPullRequests) {
let prScore = 0;
let labelsWithScores = [];
for (const label of pr.labels) {
if (scoreMap[label.name]) {
prScore += scoreMap[label.name];
labelsWithScores.push(`${label.name} score: (${scoreMap[label.name]})`);
}
}
score += prScore;
if (labelsWithScores.length > 0) {
prDetails.push(`- [#${pr.number}](${pr.html_url}) with labels: ${labelsWithScores.join(', ')}`);
}
}
const threshold = 150;
console.log(`User score: ${score}`);
console.log(`Score threshold: ${threshold}`);
if (score >= threshold) {
const comment = `Hey @${pullRequestOpener}, You have reached your limit to contribute in GameZone with a score of ${score}. \n We believe in giving equal opportunity to everyone so you will not be able to contribute to GameZone now onwards. 💗 \n Thank you for your valuable time and contribution in GameZone 🕹️! \n\n Your merged pull requests:\n${prDetails.join('\n')}`;
core.exportVariable('comment_body', comment);
core.setOutput('close_pull_request', true);
} else {
core.exportVariable('comment_body', '');
core.setOutput('close_pull_request', false);
}
- name: Add spam label and close the pull request
if: always() && steps.calculate_score.outputs.close_pull_request == 'true'
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullRequestNumber = context.payload.pull_request.number;
const comment = process.env.comment_body;
if (comment.trim() === '') {
console.log('Comment body is empty. Skipping comment creation.');
return;
}
await github.issues.createComment({
owner,
repo,
issue_number: pullRequestNumber,
body: comment
});
await github.issues.addLabels({
owner,
repo,
issue_number: pullRequestNumber,
labels: ['spam🚨']
});
await github.pulls.update({
owner,
repo,
pull_number: pullRequestNumber,
state: 'closed'
});
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

assets/images/Pixel_Painter.png
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

22 changes: 22 additions & 0 deletions Games/Chess_Game_computer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 🎮 AI Chess Game Request

## **Description 📃**
We propose the development of an AI-powered chess game that offers an engaging and challenging experience to players of all levels. The game will leverage advanced algorithms to provide intelligent gameplay while also offering a user-friendly interface for an immersive gaming experience.

## **functionalities 🎮**
- **Intelligent AI Opponent**: The game will feature an AI opponent with varying levels of difficulty, from beginner to grandmaster, to provide a challenging experience for players of all skill levels.

## **How to play? 🕹️**
- Players can make moves by dragging and dropping chess pieces to desired locations on the board.
- The game will follow standard chess rules, including move validation and checkmate detection.
- Players can select the difficulty level of the AI opponent to match their skill level.

<br>

## **Screenshots 📸**

<br>
![image](../../assets/images/chessComputer.png)

<br>

14 changes: 14 additions & 0 deletions Games/Chess_Game_computer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>Chess Engine</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
</head>
<body>
<div id="container"></div>

<script src="script.js"></script>
</body>
</html>
Loading

0 comments on commit cb1b0f4

Please sign in to comment.