0

Hi. Iam doing my first game and its going very well.
Its the classic African Kalah (with egyptian rules)
There is a problem. And you gotta know the basics of kalah to solve it.
hole1(4)--hole2(4)...
there are 12 holes. When i click the first one, the next 4 holes get 1 more piece., But when I click hole2, that has now 5 pieces, only the next four get 1 more. The next 5 should get 1 more piece.

Code:
function move(hole)
{
holeID = hole.id
holeNum = holeID.replace(/hole/,'')
holeBalls = hole.value
hole.value = 0
holeNum++
holeBalls++
for (d=holeNum;d<=holeBalls;d++)
{
document.getElementById('hole'+d).value ++
}
}

each hole executes move(this) onclick

2
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by ~s.o.s~
0

I don't think everyone would learn a new game just to help you out, so you should at least post the complete relevant code and the exact nature of the problem(warnings, errors, bugs). The current description seems so lost.

0

I told you that you didn't really have to know kalah, my bad to write it down there.
The problem is that holeBalls var has to be = to the value stored in each hole (got by getelementbyid function), but somehow, it limits itself to be the value of the first hole clicked

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.