You are not logged in.
(according to my calculations)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
No, siva.eas's guess doesn't match the result from guess 6.
My calculations show that either ganesh is right, with 1204, or the answer is Guess 9 (because siva actually had guess 8): 1206.
Why did the vector cross the road?
It wanted to be normal.
Offline
I think her result match, but we'll see soon.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
I'm starting writing cowbull program in Mathematica.
I think I'll be ready soon.
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Here's some code:
len[n_] := Length[IntegerDigits[n]]
(*This gives the number of digits of n*)
diff[n_] :=
(
a := 0;
Do[
If[IntegerDigits[n][[i]] == IntegerDigits[n][[j]] && i != j, a = 1]
, {i, 1, len[n]}, {j, 1, len[n]}];
a
)
(*this gives 1 if there is repeating digit*)
cowbull[a_, b_] :=
(
c := 0;
d := 0;
If[len[a] == len[b] && diff[a] == 0 && diff[b] == 0,
Do[
If[
IntegerDigits[a][[i]] == IntegerDigits[b][[j]],
If[i != j,
c += 1,
d += 1]],
{i, 1, len[a]},
{j, 1, len[b]}];
{c, d},
Print["Please input correct numbers"]]
)
(*this is the main function. It
gives the number of cows and bulls between 2 numbers a and b*)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
If the answer was 4219, then a guess of 1289 would have returned bbc.
Why did the vector cross the road?
It wanted to be normal.
Offline
Oh yes, you're right
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Now I'm ready with my program and I'm checking it...
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Yes, Mathsy, you are right.
According to the home-made program the answers are 1204 or 1206.
It works!!!
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Here is it:
(you won't understand it easy)
(* Cow Bull *)
(* by krassi_holmz *)
(* January, 2006 *)
(*BEGINING*)
(*--------------------------------------------------------------*)
len[n_]:=Length[IntegerDigits[n]]
(* This gives the number of digits of n *)
(*--------------------------------------------------------------*)
diff[n_]:=
(
a:=0;
Do[
If[IntegerDigits[n][[i]] == IntegerDigits[n][[j]] && i!=j,a=1]
,{i,1,len[n]},{j,1,len[n]}];
a
)
(* this gives 1 if there is a repeating digit *)
(*--------------------------------------------------------------*)
cowbull[a_,b_]:=
(
c:=0;
d:=0;
If[len[a]\[Equal]len[b]&&diff[a]\[Equal]0&&diff[b]\[Equal]0,
Do[
If[
IntegerDigits[a][[i]]\[Equal]IntegerDigits[b][[j]],
If[i!=j,
c+=1,
d+=1]],
{i,1,len[a]},
{j,1,len[b]}];
{c,d},
"Please insert correct numbers"]
)
(* this is the main function. It gives the number
of cows and bulls between 2 numbers a and b *)
(*---------------------------------------------------------------*)
iscb[a_,b_,c_]:=If[Head[cowbull[a,b]]!= String && cowbull[a,b]\[Equal]c,1,0]
(* this gives 1 if the n\
umber of cows and bulls
of a and b is from the table c*)
(*---------------------------------------------------------------*)
gen[a_,data_,cb_]:=
(
p:=1;
Do[
If[
iscb[a,data[[i]],cb[[i]]]\[Equal]0,
p=0]
,{i,1,Length[data]}];
p
)
(* this is generalized iscb function. It gives 1 if all the numbers
from data list have cowbull[a,n] equal to cb[n]*)
(*----------------------------------------------------------------*)
ppt[l_]:=
(
k:=1;
Do[If[l[[i]]\[Equal]1,out[k]=i;k=k+1],{i,1,Length[l]}];
Table[1022+out[j],{j,1,k-1}]
)
(* this function is used to visualise the results. It transforms
a binary solution table to the final solution table *)
(*----------------------------------------------------------------*)
TheSolutions[data_,cb_]:=ppt[Table[gen[i,data,cb],{i,1023,9876}]]
(* this is the final function *)
(*----------------------------------------------------------------*)
(*END*)
Last edited by krassi_holmz (2006-01-06 10:35:13)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Here's the input and calling the function TheSolutions (for the last cowbull):
Last edited by krassi_holmz (2006-01-06 10:44:09)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
So Mathsy || Ganesh wins!
Congratulations Mathsy || Ganesh !
(|| means logic OR)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Guess &: 1204 bbb
Guess 9: 4219 bc
Right, didn't see next page.
Guess 8: 1206 bbbb
Mathsy wins. Again. Kudos to you.
Last edited by justlookingforthemoment (2006-01-06 12:34:55)
Offline
Cow Bull # 12
(1) Who's going to host?
(2) If the members agree, we can upgrade the game to hexadecimal. All conditions remain the same. Four digit numbers, no repititions, the number shouldn't start with zero. The only difference, we'd have to guess from 15 numbers : 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E. The number of permutations : 30,576!
Advantages :- Games of longer duration, more players get an opportunity to win.
Disadvantage :- If the host makes a mistake, the game would go on meaninglessly until someone (maybe the host) discovers there has been a mistake.
Vote for or against Hexa
It appears to me that if one wants to make progress in mathematics, one should study the masters and not the pupils. - Niels Henrik Abel.
Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.
Online
No, I'll have to rewrite my program!
Last edited by krassi_holmz (2006-01-06 23:28:37)
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Yes, because krazzi will have to rewrite his program!
But seriously, I think it will be much more fun this way. Using a computer program could be considered cheating, anyway.
I'll host this game. I've got 2 possible numbers, depending on whether the rule change gets accepted or not.
Why did the vector cross the road?
It wanted to be normal.
Offline
OK. I agree. I've written my program for demical numbers, but my style is "function programing" so it won't be hard to generalize my program. Actually I have to rewrite only some functions becouse the i can you many of old functions. But I won't cheat. I promise.
I suggest to have two games at once:
hexademic cb1:
guess 1: def3
demical cb12:
guess 1:1234
IPBLE: Increasing Performance By Lowering Expectations.
Offline
2 games at once? That will be... interesting. Well, it never hurts to try something once, so let's see how this turns out.
Hex Guess 1: DEF3 (bc)
Dec Guess 1: 1234 (cc)
Why did the vector cross the road?
It wanted to be normal.
Offline
Hex Guess 2:ABFD
Dec Guess 2:5678
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Hex 2: ABFD (bcc)
Dec 2: 5678 (cc)
Why did the vector cross the road?
It wanted to be normal.
Offline
Thats very interesting! Two games simulataneously, one in Decimal and the other in Hexa!
Guess 3 : Hex : DBFA
Guess 3 : Dec : 3904
It appears to me that if one wants to make progress in mathematics, one should study the masters and not the pupils. - Niels Henrik Abel.
Nothing is better than reading and gaining more and more knowledge - Stephen William Hawking.
Online
Hex 3: DBFA (ccc)
Dec 3: 3904 (-)
Why did the vector cross the road?
It wanted to be normal.
Offline
Hex 4:a3bf
Dec 4:7812
IPBLE: Increasing Performance By Lowering Expectations.
Offline
Hex 4: A3BF (cc)
Dec 4: 7812 (cccc)
Why did the vector cross the road?
It wanted to be normal.
Offline
Hex 5:badf
Dec 5:8127
IPBLE: Increasing Performance By Lowering Expectations.
Offline