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

Recommended Answers

All 3 Replies

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.

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

Maybe posting a working code will help us in finding out the cause.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.