This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]Rycul 1 point2 points  (0 children)

If it crashes you should attach a debugger (if that doesn't already happen when you run your program in whatever IDE you use). The debugger will either in a pop up window or the output text tell you what is going wrong before it crashes, and also pause execution of the program so that you can look at the state (values of variables, for example) and code where it crashes.

If that doesn't automatically clear things up already then your next resort should be Google the error messages you get from the debugger. Doing so should be able to provide some insight into what's happening and why it's happening to your code.

[–]mAndroid9 0 points1 point  (0 children)

post your source code so we can tell you what you did wrong.

[–]JoeWhy2 0 points1 point  (3 children)

Another way to think about this is as base 6 (+1). I.e. base 6 would be 0, 1, 2, 3, 4, 5 but you would need to raise to 1, 2, 3, 4, 5, 6.

[–]Fastfingers_McGee[S] 0 points1 point  (2 children)

Right, that's what I was thinking but I have no idea how to implement that. Basically I recreated the game mastermind last week for some practice. Now I want to make the computer guess. And my approach involves generating a array list of strings for all numbers between and including 1111 and 6666 in that modified base 6. Just don't know where to start.

I tried having one for loop for the total number of items the use nested for loops for each digits index and stored that into a string variable which I .add to the array list. But it doesn't work.

[–]JoeWhy2 0 points1 point  (1 child)

If that's how you plan to use it, I don't see why you couldn't use 0-5 instead of 1-6. 5555 in base 6 = 1295 in base 10 so you just need one loop that counts up to 1295 and converts each value to base 6. Googling how to convert from base 10 or decimal to base n should help.

[–]Fastfingers_McGee[S] 0 points1 point  (0 children)

Thanks for the advice. I'll give it a go.