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 #29

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 8 commits into Uncodedtech:master from avinashkranjan:master
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 BitCoin Mining/BitCoin_Mining.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def mine(block_number, transactions, previous_hash, prefix_zeros):
start = time.time()
print("start mining")

previous_hash = input('Enter Previous has value : ')
previous_hash = input('Enter Previous hash value : ')

# Calling mine function with all required parameters
new_hash = mine(5, transactions, previous_hash, difficulty)
Expand Down
4 changes: 2 additions & 2 deletions Traffic-Sign-Detection/requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ six==1.15.0
SoundFile==0.10.3.post1
tensorboard==2.4.1
tensorboard-plugin-wit==1.7.0
tensorflow==2.7.2
tensorflow==2.11.1
tensorflow-estimator==2.4.0
tensorflow-gpu==2.7.2
tensorflow-gpu==2.12.0
termcolor==1.1.0
terminado==0.9.2
testpath==0.4.4
Expand Down
Binary file added pong-pygame/Assets/ball.png
View file Open in desktop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[フレーム]
Binary file added pong-pygame/Assets/paddle.png
View file Open in desktop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[フレーム]
14 changes: 14 additions & 0 deletions pong-pygame/README.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Pygame_pong

useage:

install python from ['https://www.python.org/downloads/']

>> pip install pygame

```
python main.py
```


![Screenshot from 2023年01月01日 14-17-38](https://user-images.githubusercontent.com/68957369/210165478-2617e876-234c-4d95-b9fd-8289f8973ba2.png)
83 changes: 83 additions & 0 deletions pong-pygame/pong.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import pygame
# Initialize pygame

pygame.init() # Initialize pygame

# Set the window size
screen = pygame.display.set_mode((600, 400)) # Set the window size

# Set the title of the window
pygame.display.set_caption("Pong") # Set the title of the window

# Set up the game clock
clock = pygame.time.Clock() # Set up the game clock

# Load the images for the ball and paddles
ball_image = pygame.image.load("Assets/ball.png")
paddle_image = pygame.image.load("Assets/paddle.png")

# Create the ball sprite
ball = pygame.sprite.Sprite() # Create the ball sprite
ball.image = ball_image # Load the ball image
ball.rect = ball.image.get_rect() # Get the ball's rects

# Create the paddles
left_paddle = pygame.sprite.Sprite() # Create the left paddle
left_paddle.image = paddle_image # Load the left paddle image
left_paddle.rect = left_paddle.image.get_rect() # Get the left paddle's rect

right_paddle = pygame.sprite.Sprite() # Create the right paddle
right_paddle.image = paddle_image # Load the right paddle image
right_paddle.rect = right_paddle.image.get_rect() # Get the right paddle's rect

# Set the initial positions of the ball and paddles
ball.rect.center = (300, 200) # Set the ball's initial position
left_paddle.rect.left = 20 # Set the left paddle's initial position
left_paddle.rect.centery = 200 # Set the left paddle's initial position
right_paddle.rect.right = 580 # Set the right paddle's initial position
right_paddle.rect.centery = 200 # Set the right paddle's initial position

# Set the ball's initial velocity
ball_vx = 5 #
ball_vy = 5 #

# Game loop
while True: #
# Handle events
for event in pygame.event.get(): # Handle events
if event.type == pygame.QUIT: # Handle the QUIT event
pygame.quit() # Quit pygame
exit() # Exit the program

# Update game state
ball.rect.x += ball_vx # Update the ball's x position
ball.rect.y += ball_vy # Update the ball's y position

# Update game state
keys = pygame.key.get_pressed() # Get the keys that are pressed
if keys[pygame.K_UP]: # Check if the up key is pressed
right_paddle.rect.y -= 5 # Update the right paddle's y position
if keys[pygame.K_DOWN]: # Check if the down key is pressed
right_paddle.rect.y += 5 # Update the right paddle's y position
if keys[pygame.K_w]: # Check if the w key is pressed
left_paddle.rect.y -= 5 # Update the left paddle's y position
if keys[pygame.K_s]: # Check if the s key is pressed
left_paddle.rect.y += 5 # Update the left paddle's y position

# Check for ball collision with paddles
if ball.rect.colliderect(left_paddle.rect) or ball.rect.colliderect(right_paddle.rect): # Check for ball collision with paddles
ball_vx = -ball_vx # Reverse the ball's x velocity

# Check for ball collision with walls
if ball.rect.top < 0 or ball.rect.bottom > 400: # Check for ball collision with walls
ball_vy = -ball_vy # Reverse the ball's y velocity

# Draw the screen
screen.fill((0, 0, 0)) # Fill the screen with black
screen.blit(ball.image, ball.rect) # Draw the ball
screen.blit(left_paddle.image, left_paddle.rect) # Draw the left paddle
screen.blit(right_paddle.image, right_paddle.rect) # Draw the right paddle
pygame.display.flip() # Update the display

# Limit the frame rate
clock.tick(60)

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