DeepSeek V3-0324與Claude 3.7對比:哪個AI程式碼能力更強?

DeepSeek V3-0324與Claude 3.7對比

隨著人工智慧模型的發展,其程式設計和軟體開發能力已成為關鍵基準。DeepSeek V3 和 Claude 3.7 是編碼領域的兩個主要競爭者。DeepSeek V3-0324是DeepSeek AI的最新產品,在編碼任務方面取得了令人鼓舞的基準結果。與此同時,Anthropic 的最新模型 Claude 3.7 是一款更強大的通用型人工智慧,具有更出色的上下文理解和編碼能力。在本篇 DeepSeek V3 與 Claude 3.7 的對比中,我們將透過標準基準測試和實際應用來考察這兩個模型的效能,從而找到理想的編碼助手。

什麼是DeepSeek V3-0324?

DeepSeek V3-0324 是DeepSeek AI推出的最新人工智慧模型,旨在為編碼和推理任務提供高效能。該模型以其前代產品的成功為基礎,在效率和可用性方面取得了進步。重點在於改善開發人員的體驗和可訪問性。DeepSeek V3-0324 定位為人工智慧驅動應用的強大工具。

DeepSeek V3-0324的主要功能

以下是DeepSeek最新型號的一些主要功能:

  • 簡化使用者介面:該模型改進了DeepSeek官方平臺的介面,包括網站、移動應用程式和小程式。
  • 一致的 API 整合:開發人員受益於不變的API介面和使用方法,確保與現有系統的無縫整合。
  • 開源可訪問性:DeepSeek V3-0324 採用 MIT 許可,提高了人工智慧社羣的透明度和協作性。模型權重和技術報告可在 Hugging Face 等平臺上獲取。

如何訪問DeepSeek V3-0324

以下是訪問 DeepSeek V3-0324 的兩種主要方法。

1. 透過API訪問

對於希望將DeepSeek V3-0324納入其應用程式的使用者,應用程式介面(API)提供了一個靈活高效的解決方案。API結構與之前的版本保持不變,確保現有使用者能夠輕鬆過渡。

以下是如何透過API訪問DeepSeek V3-0324:

Step 1. 註冊獲取API金鑰

訪問DeepSeek AI的官方網站並建立賬戶。註冊完成後,導航到開發者部分並申請一個API金鑰。驗證請求時需要該金鑰。

註冊獲取API金鑰

Step 2. 向API傳送請求

一旦獲得API金鑰,就可以開始傳送請求了。使用指定的模型名稱,例如 model=’deepseek-chat’。確保你的API請求遵循DeepSeek的文件,包括正確的驗證頭和請求格式。

向API傳送請求

現有使用者無需修改: 如果您以前整合了DeepSeek的API,則無需更改設定。只需將模型參考更新為DeepSeek V3-0324(如果有任何更改),您的應用程式就能繼續無縫執行。

2. 透過DeepSeek官方平臺訪問

如果您喜歡直接訪問而不整合 API,DeepSeek V3-0324 可透過 DeepSeek 官方平臺訪問。這些平臺提供互動式介面,允許使用者即時測試模型的功能。

要從其官方網站訪問DeepSeek V3-0324,請遵循以下步驟:

  1. 開啟瀏覽器,進入 DeepSeek 人工智慧官方網站。
  2. 如果您已經有一個賬戶,請使用您的憑據登入。新使用者可以透過提供電子郵件地址和設定密碼進行註冊。
  3. 現在您可以直接輸入提示並與 DeepSeek V3-0324 互動。調整響應長度等設定。

DeepSeek官方

DeepSeek V3-0324 與 Claude 3.7:基於效能的比較

現在,讓我們開始 DeepSeek V3-0324 與 Claude 3.7 的比較。為了評估 DeepSeek V3-0324 和 Claude 3.7 的程式設計能力,我們將在不同的編碼任務中對它們進行測試。這些任務將幫助我們評估每個模型在不同複雜度下的表現。

比較將基於四個關鍵指標:

  • 程式碼質量
  • 效率
  • 錯誤處理
  • 文件

透過對這些方面的分析,我們旨在確定在不同的程式設計挑戰中,哪種模式是更可靠、更有效的編碼助手。

任務 1:分牛入舍

提示詞:You are given an array with unique elements of stalls[ ], which denote the position of a stall. You are also given an integer k which denotes the number of aggressive cows. Your task is to assign stalls to k cows such that the minimum distance between any two of them is the maximum possible.

DeepSeek V3-0324的響應過程

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
def aggressive_cows(stalls, k):
# Sort the stalls to easily calculate distances between them
stalls.sort()
n = len(stalls)
# Initialize the binary search bounds
left = 0 # Minimum possible distance
right = stalls[-1] - stalls[0] # Maximum possible distance
best = 0 # To store the maximum minimum distance found
# Binary search to find the maximum minimum distance
while left <= right:
mid = (left + right) // 2 # Current candidate for minimum distance
count = 1 # Number of cows placed, starting with the first stall
last_position = stalls[0] # Position of the last placed cow
# Try to place the cows with at least 'mid' distance apart
for i in range(1, n):
if stalls[i] - last_position >= mid:
count += 1
last_position = stalls[i]
# Early exit if all cows are placed
if count == k:
break
# If we can place all cows with 'mid' distance, try for a larger distance
if count >= k:
best = mid
left = mid + 1
# Otherwise, try for a smaller distance
else:
right = mid - 1
return best
# Test Case 1:
stalls1 = [1, 2, 4, 8, 9]
k1 = 3
print("Maximum minimum distance:", aggressive_cows(stalls1, k1))
print()
# Test Case 2:
stalls2 = [10, 1, 2, 7, 5]
k2 = 3
print("Maximum minimum distance:", aggressive_cows(stalls2, k2))
print()
# Test Case 3:
stalls3 = [2, 12, 11, 3, 26, 7]
k3 = 5
print("Maximum minimum distance:", aggressive_cows(stalls3, k3))
def aggressive_cows(stalls, k): # Sort the stalls to easily calculate distances between them stalls.sort() n = len(stalls) # Initialize the binary search bounds left = 0 # Minimum possible distance right = stalls[-1] - stalls[0] # Maximum possible distance best = 0 # To store the maximum minimum distance found # Binary search to find the maximum minimum distance while left <= right: mid = (left + right) // 2 # Current candidate for minimum distance count = 1 # Number of cows placed, starting with the first stall last_position = stalls[0] # Position of the last placed cow # Try to place the cows with at least 'mid' distance apart for i in range(1, n): if stalls[i] - last_position >= mid: count += 1 last_position = stalls[i] # Early exit if all cows are placed if count == k: break # If we can place all cows with 'mid' distance, try for a larger distance if count >= k: best = mid left = mid + 1 # Otherwise, try for a smaller distance else: right = mid - 1 return best # Test Case 1: stalls1 = [1, 2, 4, 8, 9] k1 = 3 print("Maximum minimum distance:", aggressive_cows(stalls1, k1)) print() # Test Case 2: stalls2 = [10, 1, 2, 7, 5] k2 = 3 print("Maximum minimum distance:", aggressive_cows(stalls2, k2)) print() # Test Case 3: stalls3 = [2, 12, 11, 3, 26, 7] k3 = 5 print("Maximum minimum distance:", aggressive_cows(stalls3, k3))
def aggressive_cows(stalls, k):
# Sort the stalls to easily calculate distances between them
stalls.sort()
n = len(stalls)
# Initialize the binary search bounds
left = 0  # Minimum possible distance
right = stalls[-1] - stalls[0]  # Maximum possible distance
best = 0  # To store the maximum minimum distance found
# Binary search to find the maximum minimum distance
while left <= right:
mid = (left + right) // 2  # Current candidate for minimum distance
count = 1  # Number of cows placed, starting with the first stall
last_position = stalls[0]  # Position of the last placed cow
# Try to place the cows with at least 'mid' distance apart
for i in range(1, n):
if stalls[i] - last_position >= mid:
count += 1
last_position = stalls[i]
# Early exit if all cows are placed
if count == k:
break
# If we can place all cows with 'mid' distance, try for a larger distance
if count >= k:
best = mid
left = mid + 1
# Otherwise, try for a smaller distance
else:
right = mid - 1
return best
# Test Case 1:
stalls1 = [1, 2, 4, 8, 9]
k1 = 3
print("Maximum minimum distance:", aggressive_cows(stalls1, k1))  
print()
# Test Case 2:
stalls2 = [10, 1, 2, 7, 5]
k2 = 3
print("Maximum minimum distance:", aggressive_cows(stalls2, k2)) 
print()
# Test Case 3:
stalls3 = [2, 12, 11, 3, 26, 7]
k3 = 5
print("Maximum minimum distance:", aggressive_cows(stalls3, k3))

DeepSeek V3-0324的最終輸出

DeepSeek V3-0324的最終輸出

Claude 3.7的響應過程

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
def is_possible_distance(stalls, k, min_distance):
"""
Check if it's possible to place k cows with at least min_distance between them
Args:
stalls (list): Sorted list of stall positions
k (int): Number of cows to place
min_distance (int): Minimum distance to check between cows
Returns:
bool: True if possible to place cows, False otherwise
"""
# Place the first cow at the first stall
cows_placed = 1
last_cow_position = stalls[0]
# Try to place remaining cows
for i in range(1, len(stalls)):
# If distance between current stall and last cow's position is
# at least min_distance, place a cow here
if stalls[i] - last_cow_position >= min_distance:
cows_placed += 1
last_cow_position = stalls[i]
# If we've placed all k cows, return True
if cows_placed == k:
return True
# Couldn't place all k cows
return False
def aggressive_cows(stalls, k):
"""
Find the maximum possible minimum distance between k cows
Args:
stalls (list): List of stall positions
k (int): Number of cows
Returns:
int: Maximum possible minimum distance between cows
"""
# Sort the stalls
stalls.sort()
# Binary search range is from 1 to max possible distance
left = 1
right = stalls[-1] - stalls[0]
result = 0
# Binary search to find maximum minimum distance
while left <= right:
mid = (left + right) // 2
# If we can place k cows with mid as minimum distance
if is_possible_distance(stalls, k, mid):
# Try to maximize the distance
result = mid
left = mid + 1
else:
# Reduce the distance
right = mid - 1
return result
# Test cases
test_cases = [
([1, 2, 4, 8, 9], 3),
([10, 1, 2, 7, 5], 3),
([2, 12, 11, 3, 26, 7], 5)
]
for stalls, k in test_cases:
print(f"\nStalls: {stalls}, Cows: {k}")
print(f"Maximum minimum distance: {aggressive_cows(stalls, k)}")
def is_possible_distance(stalls, k, min_distance): """ Check if it's possible to place k cows with at least min_distance between them Args: stalls (list): Sorted list of stall positions k (int): Number of cows to place min_distance (int): Minimum distance to check between cows Returns: bool: True if possible to place cows, False otherwise """ # Place the first cow at the first stall cows_placed = 1 last_cow_position = stalls[0] # Try to place remaining cows for i in range(1, len(stalls)): # If distance between current stall and last cow's position is # at least min_distance, place a cow here if stalls[i] - last_cow_position >= min_distance: cows_placed += 1 last_cow_position = stalls[i] # If we've placed all k cows, return True if cows_placed == k: return True # Couldn't place all k cows return False def aggressive_cows(stalls, k): """ Find the maximum possible minimum distance between k cows Args: stalls (list): List of stall positions k (int): Number of cows Returns: int: Maximum possible minimum distance between cows """ # Sort the stalls stalls.sort() # Binary search range is from 1 to max possible distance left = 1 right = stalls[-1] - stalls[0] result = 0 # Binary search to find maximum minimum distance while left <= right: mid = (left + right) // 2 # If we can place k cows with mid as minimum distance if is_possible_distance(stalls, k, mid): # Try to maximize the distance result = mid left = mid + 1 else: # Reduce the distance right = mid - 1 return result # Test cases test_cases = [ ([1, 2, 4, 8, 9], 3), ([10, 1, 2, 7, 5], 3), ([2, 12, 11, 3, 26, 7], 5) ] for stalls, k in test_cases: print(f"\nStalls: {stalls}, Cows: {k}") print(f"Maximum minimum distance: {aggressive_cows(stalls, k)}")
def is_possible_distance(stalls, k, min_distance):
"""
Check if it's possible to place k cows with at least min_distance between them
Args:
stalls (list): Sorted list of stall positions
k (int): Number of cows to place
min_distance (int): Minimum distance to check between cows
Returns:
bool: True if possible to place cows, False otherwise
"""
# Place the first cow at the first stall
cows_placed = 1
last_cow_position = stalls[0]
# Try to place remaining cows
for i in range(1, len(stalls)):
# If distance between current stall and last cow's position is
# at least min_distance, place a cow here
if stalls[i] - last_cow_position >= min_distance:
cows_placed += 1
last_cow_position = stalls[i]
# If we've placed all k cows, return True
if cows_placed == k:
return True
# Couldn't place all k cows
return False
def aggressive_cows(stalls, k):
"""
Find the maximum possible minimum distance between k cows
Args:
stalls (list): List of stall positions
k (int): Number of cows
Returns:
int: Maximum possible minimum distance between cows
"""
# Sort the stalls
stalls.sort()
# Binary search range is from 1 to max possible distance
left = 1
right = stalls[-1] - stalls[0]
result = 0
# Binary search to find maximum minimum distance
while left <= right:
mid = (left + right) // 2
# If we can place k cows with mid as minimum distance
if is_possible_distance(stalls, k, mid):
# Try to maximize the distance
result = mid
left = mid + 1
else:
# Reduce the distance
right = mid - 1
return result
# Test cases
test_cases = [
([1, 2, 4, 8, 9], 3), 
([10, 1, 2, 7, 5], 3),       
([2, 12, 11, 3, 26, 7], 5)               
]
for stalls, k in test_cases:
print(f"\nStalls: {stalls}, Cows: {k}")
print(f"Maximum minimum distance: {aggressive_cows(stalls, k)}")

Claude 3.7的最終輸出

Claude 3.7的最終輸出

比較分析

Claude 3.7 的程式碼更模組化、可讀性更強、文件更完善、函式文件更清晰。它避免了不必要的二進位制搜尋迭代,提高了效率。DeepSeek V3-0324 的最佳化程度稍高,可以提前退出,但缺乏錯誤處理功能。Claude 的結構化方法使新增驗證變得更容易,但兩者都缺乏明確的檢查。總的來說,Claude 3.7 在可維護性方面更勝一籌,而 DeepSeek V3-0324 的執行速度稍快。

得分:DeepSeek V3-0324:0 | Claude 3.7: 1

任務 2:水上船隻動畫

提示詞:Generate an HTML and CSS code snippet that creates an animated scene of a boat moving smoothly across the water. The water should have realistic ripples around the boat to enhance the visual effect. Use CSS animations for fluid movement and ripple effects. Ensure the design is visually appealing and runs smoothly on modern browsers.

DeepSeek V3-0324的響應過程

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animated Boat on Water</title>
<style>
body {
margin: 0;
overflow: hidden;
background: linear-gradient(to bottom, #87CEEB 0%, #1E90FF 100%);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.scene {
position: relative;
width: 100%;
height: 300px;
overflow: hidden;
}
.water {
position: absolute;
bottom: 0;
width: 100%;
height: 100px;
background: linear-gradient(to bottom, #1E90FF 0%, #00BFFF 50%, #1E90FF 100%);
}
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Animated Boat on Water</title> <style> body { margin: 0; overflow: hidden; background: linear-gradient(to bottom, #87CEEB 0%, #1E90FF 100%); height: 100vh; display: flex; justify-content: center; align-items: center; } .scene { position: relative; width: 100%; height: 300px; overflow: hidden; } .water { position: absolute; bottom: 0; width: 100%; height: 100px; background: linear-gradient(to bottom, #1E90FF 0%, #00BFFF 50%, #1E90FF 100%); }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animated Boat on Water</title>
<style>
body {
margin: 0;
overflow: hidden;
background: linear-gradient(to bottom, #87CEEB 0%, #1E90FF 100%);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.scene {
position: relative;
width: 100%;
height: 300px;
overflow: hidden;
}
.water {
position: absolute;
bottom: 0;
width: 100%;
height: 100px;
background: linear-gradient(to bottom, #1E90FF 0%, #00BFFF 50%, #1E90FF 100%);
}

DeepSeek V3-0324的最終輸出

Claude3.7的響應過程

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Boat on Waves Animation</title>
<style>
body, html {
margin: 0;
height: 100%;
overflow: hidden;
background: linear-gradient(to bottom, #87CEEB, #4682B4);
display: flex;
justify-content: center;
align-items: center;
}
.ocean {
width: 100%;
height: 40%;
position: absolute;
bottom: 0;
left: 0;
background: linear-gradient(to bottom, rgba(65,105,225,0.7), rgba(30,144,255,0.9));
overflow: hidden;
}
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Boat on Waves Animation</title> <style> body, html { margin: 0; height: 100%; overflow: hidden; background: linear-gradient(to bottom, #87CEEB, #4682B4); display: flex; justify-content: center; align-items: center; } .ocean { width: 100%; height: 40%; position: absolute; bottom: 0; left: 0; background: linear-gradient(to bottom, rgba(65,105,225,0.7), rgba(30,144,255,0.9)); overflow: hidden; }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Boat on Waves Animation</title>
<style>
body, html {
margin: 0;
height: 100%;
overflow: hidden;
background: linear-gradient(to bottom, #87CEEB, #4682B4);
display: flex;
justify-content: center;
align-items: center;
}
.ocean {
width: 100%;
height: 40%;
position: absolute;
bottom: 0;
left: 0;
background: linear-gradient(to bottom, rgba(65,105,225,0.7), rgba(30,144,255,0.9));
overflow: hidden;
}

Claude 3.7的最終輸出

對比分析

DeepSeek V3-0324 的小船能完美地漂浮在水面上,畫面效果更好,營造了一個視覺上吸引人的逼真場景。而克勞德的小船則上下顛倒,降低了真實感。DeepSeek V3-0324 的波紋增強了水的動態效果,而克勞德的動畫則缺乏流動性。兩者都能流暢執行,但 DeepSeek V3-0324 的設計更精緻,視覺效果更吸引人。總的來說,DeepSeek V3-0324 提供了更出色的美感和更精確的動作,是更好的動畫模型。

得分:DeepSeek V3-0324:1 | Claude 3.7: 1

任務 3:Python經典貪吃蛇遊戲

提示詞:Generate a Python script for the classic Snake game using the pygame library.

DeepSeek V3-0324的響應過程

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
def game_loop():
"""Main game loop."""
game_over = False
game_close = False
# Initial snake position
x1 = dis_width / 2
y1 = dis_height / 2
# Snake movement
x1_change = 0
y1_change = 0
# Snake body
snake_list = []
length_of_snake = 1
# Food position
foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0
foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0
while not game_over:
while game_close:
# Game over screen
dis.fill(white)
message("You Lost! Press Q-Quit or C-Play Again", red)
your_score(length_of_snake - 1)
pygame.display.update()
# Check for player input after game over
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
game_over = True
game_close = False
if event.key == pygame.K_c:
game_loop()
# Handle keyboard events
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_over = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
x1_change = -snake_block
y1_change = 0
elif event.key == pygame.K_RIGHT:
x1_change = snake_block
y1_change = 0
elif event.key == pygame.K_UP:
y1_change = -snake_block
x1_change = 0
elif event.key == pygame.K_DOWN:
y1_change = snake_block
x1_change = 0
# Check for boundary collision
if x1 >= dis_width or x1 < 0 or y1 >= dis_height or y1 < 0:
game_close = True
# Update snake position
x1 += x1_change
y1 += y1_change
dis.fill(white)
# Draw food
pygame.draw.rect(dis, red, [foodx, foody, snake_block, snake_block])
# Update snake body
snake_head = []
snake_head.append(x1)
snake_head.append(y1)
snake_list.append(snake_head)
# Remove extra segments if snake hasn't eaten
if len(snake_list) > length_of_snake:
del snake_list[0]
# Check for self-collision
for x in snake_list[:-1]:
if x == snake_head:
game_close = True
# Draw snake and score
our_snake(snake_block, snake_list)
your_score(length_of_snake - 1)
pygame.display.update()
# Check if snake ate food
if x1 == foodx and y1 == foody:
foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0
foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0
length_of_snake += 1
# Control game speed
clock.tick(snake_speed)
# Quit pygame
pygame.quit()
quit()
# Start the game
game_loop()
def game_loop(): """Main game loop.""" game_over = False game_close = False # Initial snake position x1 = dis_width / 2 y1 = dis_height / 2 # Snake movement x1_change = 0 y1_change = 0 # Snake body snake_list = [] length_of_snake = 1 # Food position foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0 foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0 while not game_over: while game_close: # Game over screen dis.fill(white) message("You Lost! Press Q-Quit or C-Play Again", red) your_score(length_of_snake - 1) pygame.display.update() # Check for player input after game over for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_q: game_over = True game_close = False if event.key == pygame.K_c: game_loop() # Handle keyboard events for event in pygame.event.get(): if event.type == pygame.QUIT: game_over = True if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: x1_change = -snake_block y1_change = 0 elif event.key == pygame.K_RIGHT: x1_change = snake_block y1_change = 0 elif event.key == pygame.K_UP: y1_change = -snake_block x1_change = 0 elif event.key == pygame.K_DOWN: y1_change = snake_block x1_change = 0 # Check for boundary collision if x1 >= dis_width or x1 < 0 or y1 >= dis_height or y1 < 0: game_close = True # Update snake position x1 += x1_change y1 += y1_change dis.fill(white) # Draw food pygame.draw.rect(dis, red, [foodx, foody, snake_block, snake_block]) # Update snake body snake_head = [] snake_head.append(x1) snake_head.append(y1) snake_list.append(snake_head) # Remove extra segments if snake hasn't eaten if len(snake_list) > length_of_snake: del snake_list[0] # Check for self-collision for x in snake_list[:-1]: if x == snake_head: game_close = True # Draw snake and score our_snake(snake_block, snake_list) your_score(length_of_snake - 1) pygame.display.update() # Check if snake ate food if x1 == foodx and y1 == foody: foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0 foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0 length_of_snake += 1 # Control game speed clock.tick(snake_speed) # Quit pygame pygame.quit() quit() # Start the game game_loop()
def game_loop():
"""Main game loop."""
game_over = False
game_close = False
# Initial snake position
x1 = dis_width / 2
y1 = dis_height / 2
# Snake movement
x1_change = 0
y1_change = 0
# Snake body
snake_list = []
length_of_snake = 1
# Food position
foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0
foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0
while not game_over:
while game_close:
# Game over screen
dis.fill(white)
message("You Lost! Press Q-Quit or C-Play Again", red)
your_score(length_of_snake - 1)
pygame.display.update()
# Check for player input after game over
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
game_over = True
game_close = False
if event.key == pygame.K_c:
game_loop()
# Handle keyboard events
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_over = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
x1_change = -snake_block
y1_change = 0
elif event.key == pygame.K_RIGHT:
x1_change = snake_block
y1_change = 0
elif event.key == pygame.K_UP:
y1_change = -snake_block
x1_change = 0
elif event.key == pygame.K_DOWN:
y1_change = snake_block
x1_change = 0
# Check for boundary collision
if x1 >= dis_width or x1 < 0 or y1 >= dis_height or y1 < 0:
game_close = True
# Update snake position
x1 += x1_change
y1 += y1_change
dis.fill(white)
# Draw food
pygame.draw.rect(dis, red, [foodx, foody, snake_block, snake_block])
# Update snake body
snake_head = []
snake_head.append(x1)
snake_head.append(y1)
snake_list.append(snake_head)
# Remove extra segments if snake hasn't eaten
if len(snake_list) > length_of_snake:
del snake_list[0]
# Check for self-collision
for x in snake_list[:-1]:
if x == snake_head:
game_close = True
# Draw snake and score
our_snake(snake_block, snake_list)
your_score(length_of_snake - 1)
pygame.display.update()
# Check if snake ate food
if x1 == foodx and y1 == foody:
foodx = round(random.randrange(0, dis_width - snake_block) / 10.0) * 10.0
foody = round(random.randrange(0, dis_height - snake_block) / 10.0) * 10.0
length_of_snake += 1
# Control game speed
clock.tick(snake_speed)
# Quit pygame
pygame.quit()
quit()
# Start the game
game_loop()

DeepSeek V3-0324的最終輸出

Claude 3.7的響應過程

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
def main():
# Initialize game objects
snake = Snake()
food = Food(snake)
score = 0
# Font for displaying score
font = pygame.font.Font(None, 36)
# Game loop
running = True
while running:
# Event handling
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Handle keyboard input for snake direction
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP and snake.direction != (0, 1):
snake.direction = (0, -1)
elif event.key == pygame.K_DOWN and snake.direction != (0, -1):
snake.direction = (0, 1)
elif event.key == pygame.K_LEFT and snake.direction != (1, 0):
snake.direction = (-1, 0)
elif event.key == pygame.K_RIGHT and snake.direction != (-1, 0):
snake.direction = (1, 0)
# Move the snake
snake.move()
# Check for food collision
if snake.body[0] == food.position:
snake.grow = True
food.position = food.generate_position(snake)
score += 1
# Check for self-collision
if snake.check_collision():
running = False
# Clear the screen
screen.fill(BLACK)
# Draw game objects
snake.draw(screen)
food.draw(screen)
# Render score
score_text = font.render(f'Score: {score}', True, WHITE)
screen.blit(score_text, (10, 10))
# Update display
pygame.display.flip()
# Control game speed
clock.tick(10) # 10 frames per second
# Game over screen
screen.fill(BLACK)
game_over_text = font.render('Game Over', True, WHITE)
final_score_text = font.render(f'Final Score: {score}', True, WHITE)
screen.blit(game_over_text, (WIDTH//2 - game_over_text.get_width()//2, HEIGHT//2 - 50))
screen.blit(final_score_text, (WIDTH//2 - final_score_text.get_width()//2, HEIGHT//2 + 50))
pygame.display.flip()
# Wait for a moment before closing
pygame.time.wait(2000)
# Quit Pygame
pygame.quit()
# Run the game
if __name__ == '__main__':
main()
def main(): # Initialize game objects snake = Snake() food = Food(snake) score = 0 # Font for displaying score font = pygame.font.Font(None, 36) # Game loop running = True while running: # Event handling for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # Handle keyboard input for snake direction if event.type == pygame.KEYDOWN: if event.key == pygame.K_UP and snake.direction != (0, 1): snake.direction = (0, -1) elif event.key == pygame.K_DOWN and snake.direction != (0, -1): snake.direction = (0, 1) elif event.key == pygame.K_LEFT and snake.direction != (1, 0): snake.direction = (-1, 0) elif event.key == pygame.K_RIGHT and snake.direction != (-1, 0): snake.direction = (1, 0) # Move the snake snake.move() # Check for food collision if snake.body[0] == food.position: snake.grow = True food.position = food.generate_position(snake) score += 1 # Check for self-collision if snake.check_collision(): running = False # Clear the screen screen.fill(BLACK) # Draw game objects snake.draw(screen) food.draw(screen) # Render score score_text = font.render(f'Score: {score}', True, WHITE) screen.blit(score_text, (10, 10)) # Update display pygame.display.flip() # Control game speed clock.tick(10) # 10 frames per second # Game over screen screen.fill(BLACK) game_over_text = font.render('Game Over', True, WHITE) final_score_text = font.render(f'Final Score: {score}', True, WHITE) screen.blit(game_over_text, (WIDTH//2 - game_over_text.get_width()//2, HEIGHT//2 - 50)) screen.blit(final_score_text, (WIDTH//2 - final_score_text.get_width()//2, HEIGHT//2 + 50)) pygame.display.flip() # Wait for a moment before closing pygame.time.wait(2000) # Quit Pygame pygame.quit() # Run the game if __name__ == '__main__': main()
def main():
# Initialize game objects
snake = Snake()
food = Food(snake)
score = 0
# Font for displaying score
font = pygame.font.Font(None, 36)
# Game loop
running = True
while running:
# Event handling
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Handle keyboard input for snake direction
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP and snake.direction != (0, 1):
snake.direction = (0, -1)
elif event.key == pygame.K_DOWN and snake.direction != (0, -1):
snake.direction = (0, 1)
elif event.key == pygame.K_LEFT and snake.direction != (1, 0):
snake.direction = (-1, 0)
elif event.key == pygame.K_RIGHT and snake.direction != (-1, 0):
snake.direction = (1, 0)
# Move the snake
snake.move()
# Check for food collision
if snake.body[0] == food.position:
snake.grow = True
food.position = food.generate_position(snake)
score += 1
# Check for self-collision
if snake.check_collision():
running = False
# Clear the screen
screen.fill(BLACK)
# Draw game objects
snake.draw(screen)
food.draw(screen)
# Render score
score_text = font.render(f'Score: {score}', True, WHITE)
screen.blit(score_text, (10, 10))
# Update display
pygame.display.flip()
# Control game speed
clock.tick(10)  # 10 frames per second
# Game over screen
screen.fill(BLACK)
game_over_text = font.render('Game Over', True, WHITE)
final_score_text = font.render(f'Final Score: {score}', True, WHITE)
screen.blit(game_over_text, (WIDTH//2 - game_over_text.get_width()//2, HEIGHT//2 - 50))
screen.blit(final_score_text, (WIDTH//2 - final_score_text.get_width()//2, HEIGHT//2 + 50))
pygame.display.flip()
# Wait for a moment before closing
pygame.time.wait(2000)
# Quit Pygame
pygame.quit()
# Run the game
if __name__ == '__main__':
main()

Claude 3.7的最終輸出

比較分析

DeepSeek V3-0324 的 “貪吃蛇 ”遊戲能在邊界碰撞時正確結束,但需要按鍵才能開始,這增加了一些小摩擦。克勞德版本無法檢測邊界碰撞,降低了遊戲的準確性。DeepSeek V3-0324 的遊戲在同時按下左右鍵時自動結束,這可能會令人沮喪。總的來說,Claude 3.7 可確保更好的遊戲邏輯,而 DeepSeek V3-0324 則需要修復才能獲得完整的體驗。

得分: DeepSeek V3-0324:1 | Claude 3.7:2

最終得分

DeepSeek V3-0324:1 | Claude 3.7: 2

程式碼檔案: 如需完整版程式碼檔案,請點選此處

Overall Analysis

指標 任務1:分牛入舍 任務2:船動畫 任務3:貪食蛇遊戲 Overall Verdict
程式碼質量 Claude 3.7 模組化程度更高,文件更完善 DeepSeek V3-0324 的視覺效果和結構更好。 DeepSeek-V3 具有更好的碰撞處理能力。 DeepSeek V3-0324 在執行方面表現出色,Claude 3.7 在可讀性方面表現出色。
效率 DeepSeek V3-0324 速度稍快,但退出較早。 兩者都能流暢執行,但 DeepSeek V3-0324 的動畫更精緻。 DeepSeek V3-0324 能很好地處理邊界碰撞。 DeepSeek V3-0324 提供了更好的最佳化。
錯誤處理 Claude 3.7 缺乏明確的檢查,但更容易驗證 Claude的船是顛倒的,降低了真實感。 Claude 3.7 無法檢測邊界碰撞。 Claude 3.7 需要修復執行問題。
視覺效果 DeepSeek V3-0324 的畫面和波紋效果更好。 DeepSeek V3-0324 在美學方面領先。
執行精度 兩者都能正確工作,但 DeepSeek V3-0324 缺乏驗證 DeepSeek V3-0324 的小船漂浮得很好,而 Claude 3.7 的小船則錯位了。 DeepSeek 的遊戲能正確結束;Claude 3.7 無法檢測邊界碰撞。 DeepSeek V3-0324 提供了更好的功能正確性。
最終結論 Claude 3.7 的可維護性更好,DeepSeek V3-0324 的速度更快。 DeepSeek V3-0324 的輸出在視覺效果上更勝一籌,而且執行得很好。 DeepSeek V3-0324 可確保更好的遊戲邏輯,而 Claude 3.7 則存在重大缺陷。 DeepSeek-V3 在執行和視覺效果方面更勝一籌。

DeepSeek V3-0324與Claude 3.7:基準測試比較

現在,讓我們來看看這兩種型號的基準測試結果。

1. Aider多語言基準測試

該基準測試衡量 LLM 使用流行語言進行編碼的能力,以及它能否編寫與現有程式碼相整合的新程式碼。

Aider 多語言基準測試

DeepSeek V3-0324 在“類衍格式”下的準確率約為 55%,成本適中。與此同時,Claude 3.7(32K 思考tokens)的準確率達到了 65-67% 左右,是所有測試模型中最高的。即使Claude 3.7(無思考)的準確率也達到了 60% 左右。不過,與 DeepSeek V3-0324 相比,這些模型的成本較高。

2. Chatbot Arena排行榜

模型 Arena 得分 排名 (UB) 排名 (StyleCtrl) 票數 開發商 許可
DeepSeek V3-0324 1318 12 12 22,848 DeepSeek DeepSeek
Claude 3.7  (Thinking-32K) 1302 14 3 4,487 Anthropic Proprietary

Source: Lmarena.ai

基準洞察:

  • 根據競技場得分和排名,DeepSeek V3-0324 似乎是更強的通用模型。
  • Claude 3.7(Thinking-32K)在結構化或基於風格的輸出方面可能更勝一籌,因為它的 StyleCtrl 排名較高。
  • DeepSeek V3-0324 的票數更高,因此採用範圍更廣。

3. 其他基準

DeepSeek-V3 0324 和 Claude-Sonnet 3.7 的基準測試結果

以下是 DeepSeek-V3 0324 和 Claude-Sonnet 3.7 的基準測試結果明細:

MMLU-Pro(精確匹配 – EM):

DeepSeek V3 0324: 81.2% | Claude 3.7 Sonnet: 75.9%

分析:DeepSeek V3 0324 在處理多工語言理解和複雜推理方面表現出更強的能力,得分高於 Claude 3.7 Sonnet。

GPQADiamond(Pass@1):

DeepSeek V3 0324: 86.1% | Claude 3.7 Sonnet: 80.7%

分析:DeepSeek V3 0324 在回答複雜的常識和推理問題方面再次勝過 Claude 3.7 Sonnet,展示了更好的答題能力。

MATH-500 (Pass@1):

DeepSeek V3 0324: 68.4% | Claude 3.7 Sonnet: 60.1%

分析:與 Claude 3.7 Sonnet 相比,DeepSeek V3 0324 在數學問題解決方面得分更高,表明其在解決各種數學相關任務方面的能力更強。

AIME 2024 (Pass@1):

DeepSeek V3 0324: 94.0% | Claude 3.7 Sonnet: 82.2%

分析:DeepSeek V3 0324在高階推理任務中表現出色,在更復雜的多步驟任務中明顯優於Claude 3.7 Sonnet。

LiveCodeBench (Pass@1):

DeepSeek V3 0324: 90.2% | Claude 3.7 Sonnet: 82.6%

分析:DeepSeek V3 0324 在編碼和軟體開發任務中得分更高,反映出它對即時程式設計、除錯和編碼挑戰有更好的理解。

小結

DeepSeek V3-0324 以其準確性、高效率和強大的執行力在多項任務中脫穎而出。它能確保編碼挑戰、動畫和遊戲邏輯的功能正確無誤,因此在實際應用中非常可靠。Claude 3.7 雖然結構合理、可讀性強,但在執行方面存在缺陷,影響了可用性。DeepSeek V3-0324 卓越的最佳化和完善的輸出使其成為注重效能和正確性的開發人員的首選。與此同時,Claude 3.7 對那些重視程式碼的簡潔性和可維護性的人來說仍然非常有用。

評論留言