+ 2
Matchstick game(logic)
you have total 21 sticks. one player can pick 1,2,3or 4 sticks. user wii start the game. the player who have to pick the last stick will lose the game. make sure computer must always win. write a program for this code in various languages.
6 odpowiedzi
+ 5
if it is your turn, at the end good numbers are
2,3,4,5
so the other one should have 6
to achieve that, good numbers for you are
7,8,9,10
so the other should have 11
good numbers for you
12,12,14,15
the other should have 16
good numbers for you
17,18,19,20
the other should have 21
The Beginner is always the looser
The other takes (sticks mod 5 ) -1
@rjprince is the same rule: other took + youtook is always 5.
+ 5
https://code.sololearn.com/c4ptFH28R0yp/?ref=app
this is my code in c++
+ 4
this is my code in c language
https://code.sololearn.com/c155hiA3wIB6/?ref=app
+ 2
I was try, in c# check this:
https://code.sololearn.com/c0m6PzThmL2d/?ref=app
+ 2
I want this code in php or JS.