From 48ce5126c8b4321c2a6135648e1ac8d3fef8a261 Mon Sep 17 00:00:00 2001 From: james <1943357252@qq.com> Date: Mon, 5 Aug 2024 11:29:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E6=A6=82=E7=8E=87=E6=94=B9=E5=88=B050?= =?UTF-8?q?%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dayandnight/mysnake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dayandnight/mysnake.c b/dayandnight/mysnake.c index aa629dd..c472a3b 100644 --- a/dayandnight/mysnake.c +++ b/dayandnight/mysnake.c @@ -57,8 +57,8 @@ void snake_entry(void *parameter) { if (!snake_pressed) { - //80%的概率保持当前方向,20%的概率随机改变方向 - if (rand() % 100 < 20) + //50%的概率保持当前方向,20%的概率随机改变方向 + if (rand() % 100 < 50) { new_direction = rand() % 3; now_direction = (now_direction + 3 + new_direction) % 4; // 防止反向,走回头路