中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-05 23:48
48,039 topics / 350,124 posts / today 2 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Original] Guess the number game based on returning the correct number of digits and their counts
Printable Version  2,486 / 16
Floor1 qzwqzw Posted 2007-07-30 07:48
银牌会员 Posts 636 Credits 2,343
### Simple Introduction of this game
There are four decimal digits, and you can guess 8 times.
Each time, it returns aAbB.
A means the digit is correct and in the correct position.
B means the digit is correct but in the wrong position.”

For example: Suppose the number to guess is 1234.
If the player guesses 0134, it returns 2A1B (3, 4 are A, 1 is B).
----------------------------------------------------------------------

### About this code
Because it's only initially implemented,
it's inevitable to be somewhat crude.
Now I feel I took a wrong turn on JudgeNum.
I'll improve it when I have time.
Reverse guessing really tests the program algorithm.
Everyone, if you have any good ideas,
feel free to put them forward for discussion.



[ Last edited by qzwqzw on 2007-9-25 at 11:19 AM ]
Floor2 ccwan Posted 2007-07-30 10:20
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
The song that is too lofty has few who can sing along. One can only watch the dust and be unable to catch up.
Floor3 hackerflysky Posted 2007-07-31 02:39
初级用户 Posts 20 Credits 50 From 湖南常宁
Floor4 qzwqzw Posted 2007-07-31 08:08
银牌会员 Posts 636 Credits 2,343
It seems that no one has provided opinions.
Post a demo of reverse guessing by myself.

The Judge has been modified.
The premise is that the digits of the target number to be compared are all unique. This can be limited in the non - demo.

The algorithm of Guess is relatively weak.
It probably needs 5 to 8 times in terms of both speed and the number of guesses.
In the 2nd to 4th times, there may be a situation where guessing is very slow.
Because it is judging one by one at that time.

If each time we carry out the judgment one by one, then the number of guesses will be effectively reduced, but the guessing time will be greatly increased.
So the existing algorithm is the result after comprehensive consideration.



[ Last edited by qzwqzw on 2007 - 8 - 1 at 10:19 AM ]
Floor5 Noname Posted 2007-07-31 18:04
新手上路 Posts 9 Credits 18
Good game......
Floor6 tao0610 Posted 2007-07-31 18:52
高级用户 Posts 218 Credits 579
A guessing number game written a long time ago. The gameplay is similar.
It was a bit messy when I wrote it back then, and I'm too lazy to fix it.

Floor7 qzwqzw Posted 2007-08-01 10:20
银牌会员 Posts 636 Credits 2,343
Now release an interactive guessing version

Floor8 qzwqzw Posted 2007-08-01 18:46
银牌会员 Posts 636 Credits 2,343
tao0610
It is best to allow users to enter repeated numbers. Although the target number is always non - repeated, using test numbers with repeated digits may facilitate determining the target number.
Floor9 tao0610 Posted 2007-08-01 23:56
高级用户 Posts 218 Credits 579
Just remove the part about judging repeated input. Actually, within 10 times, judging the target number is not that difficult.
Floor10 qzwqzw Posted 2007-08-02 18:24
银牌会员 Posts 636 Credits 2,343
Now release a fully functional Release 1 version

Floor11 qzwqzw Posted 2007-08-02 18:25
银牌会员 Posts 636 Credits 2,343
tao0610
If duplicate numbers are allowed, your :next also needs to be modified; otherwise, the B value may be repeatedly accumulated
Floor12 dosmania Posted 2007-09-25 14:09
初级用户 Posts 54 Credits 172
to qzwqzw:

Hehe``July 30th, probably also when I was researching this game, didn't expect that you were also researching this back then~
Tested your release 1 version
All four modes have issues, specifically see my screenshots:









[ Last edited by dosmania on 2007-9-25 at 02:11 PM ]
Floor13 qzwqzw Posted 2007-09-25 14:45
银牌会员 Posts 636 Credits 2,343
Why take screenshots of cmd output? Just copy and paste the text directly :)

The error you encountered can't be reproduced when I debug it. It might be due to differences in the running environment. I heard you are quite knowledgeable about this, so please help track and debug the code to identify the problem point, which will help us solve the problem together. Thanks!

[ Last edited by qzwqzw on 2007-9-26 at 10:52 PM ]
Floor14 dosmania Posted 2007-09-26 14:13
初级用户 Posts 54 Credits 172
You have the chance to explain, but unfortunately I don't have the chance to apologize.
I have already lost the chance to become a member of the internal group of this forum.
----------------------------------------------------------
If things are made clear, misunderstandings can be avoided to a large extent. It was a misunderstanding...
You should know that it took me about 10 minutes to test your code...
What I got was "not understanding" from others. Everyone would get angry...
------------------------------------------------------------
If you are interested in the code of that game, you can browse my post again...
------------------------------------------------------------
Finally, I apologize...

[ Last edited by dosmania on 2007-9-26 at 08:56 PM ]
Floor15 dosmania Posted 2007-09-26 21:28
初级用户 Posts 54 Credits 172
You have the chance to explain, but unfortunately I don't have the chance to apologize.
I have lost the chance to become a member of the internal group of this forum because of this.
----------------------------------------------------------
If things are made clear, misunderstandings can be avoided to a large extent, it's a misunderstanding...
You should know that it took me about 10 minutes to test your code...
What I got was "not understanding" from others, anyone would get angry...
------------------------------------------------------------
If you are interested in the code of that game, take another look at my post...
------------------------------------------------------------
Finally, I apologize...
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023