ChatGPTにピンポンゲームが遊べるコード書いてって頼んだら5秒で書いてくれた
■ このスレッドは過去ログ倉庫に格納されています
PythonでもC言語でもOK
翻訳も一瞬
魔法かな? ソースコードでもコンパイルしたデータでもいいからうPしてよ ChatGPTにたのんだらコンパイルとリリースまでしてくれて勝手に10億ドル入ってた >>4
10110110 01101101 10011010 00011100 10110101 11001100 11101010 10011011
01101110 10011001 11001100
00011101 10110111
11101011 01101111 10011010 11001101 10110101 00011111 10110110 01101100 10110111 01101100 10110110 00011101 10110111
11101011 01101111 10011010 11001101 10110101 00011111 10110110 01101100 pygamesを使って簡易テトリスのソースコードを書いてください。
PythonのPygameライブラリを使用して基本的なテトリスゲームを作成するコードは以下の通りです。以下のコードは非常に簡単な形でテトリスを実装しており、詳細なコリジョンチェック、線消去、スコアリングなどは含んでいません。これらの詳細機能を実装するには、より高度なゲームロジックとデータ構造が必要となります。
import pygame
import random
pygame.font.init()
# 画面サイズの設定
s_width = 800
s_height = 700
play_width = 300
play_height = 600
block_size = 30
# テトロミノの形
shapes = [
[[1, 1, 1, 1]],
[[1, 1], [1, 1]],
[[1, 1, 0], [0, 1, 1]],
[[0, 1, 1], [1, 1]],
[[1, 1, 1], [0, 1, 0]],
[[1, 1, 1], [0, 0, 1]],
[[1, 1, 1], [1, 0, 0]]
]
# テトロミノの色
shape_colors = [(0, 0, 255), (255, 0, 0), (0, 255, 0), (255, 255, 0), (255, 165, 0), (0, 255, 255), (128, 0, 128)]
# テトロミノのクラス
class Piece(object):
def __init__(self, column, row, shape):
self.x = column
self.y = row
self.shape = shape
self.color = random.choice(shape_colors)
self.rotation = 0
def create_grid(locked_positions={}):
grid = [[(0,0,0) for _ in range(10)] for _ in range(20)]
for y in range(len(grid)):
for x in range(len(grid[y])):
if (x, y) in locked_positions:
color = locked_positions[(x,y)]
grid[y][x] = color
return grid
def draw_window(surface, grid):
surface.fill((0, 0, 0))
for y in range(len(grid)):
for x in range(len(grid[y])):
pygame.draw.rect(surface, grid[y][x], (x*30, y*30, 30, 30), 0)
pygame.display.update() def main():
locked_positions = {}
grid = create_grid(locked_positions)
change_piece = False
run = True
current_piece = Piece(5, 0, random.choice(shapes))
next_piece = Piece(5, 0, random.choice(shapes))
clock = pygame.time.Clock()
fall_time = 0
while run:
grid = create_grid(locked_positions)
fall_speed = 0.27
fall_time += clock.get_rawtime()
clock.tick()
if fall_time / 1000 > fall_speed:
fall_time = 0
current_piece.y += わしも抽出のjs頼んだら秒で書いてくれて感謝しとる ■ このスレッドは過去ログ倉庫に格納されています