I presume this is the right place to post this as technically not GLB related regarding coding etc.
As I am still learning GLB I thought that rather than browse through the commands writing little bits here & there, I would instead take the LOGO game tutorial & expand on it. For example do up the graphics, add sound, title screen etc etc, that way I can pretty much use a lot of the graphics commands & others.
One of the features I thought of adding was some kind of scoring (along with a high score table for example) & one way I could implement that was get the computer to solve the puzzle & work out the minimum amount of clicks required to complete it. So as an example the bonus score is say 1000 points & the pc works out that 45 clicks is the minimum to solve it, for every click over 45 the bonus drops 100 points or something.
Writing the code to solve it will not a problem, the problem is (rather embarrassingly) that I cannot get my head around the tactic/strategy to solve the puzzle myself lol.
It's just one of those puzzles that I cannot figure out, the rules are so simple & more than likely the solution is as well but its just not popping in my head :rant:. I done a search on the Amiga LOGO game which its based & drew a blank, even got the Amiga version & that's harder as it has a timer which counts down from 1 minute (seeing as I can spend 10mins & still not get past level 1 on the tutorial one the Amiga one does not help).
If anyone knows the tactic or if there is another name for that puzzle (can't really see the Amiga version being an original, but who know's) that I can search for that would be very much appreciated. I have saved the scoring system till last on my to-do list so no rush for answers & if no joy will have to think up another way to score the game, other than the amount of clicks it takes the player as it currently stands.
Cheers
Lee
I can understand if nobody replies for some time while they are busy ROFL at this :noggin:
I'm not sure what LOGO is like to play and haven't seen the tutorial...but...sounds like the kind of problem that just has to be thought out carefully step by step and perhaps many times before one or more solutions become clear. Some might be quick, like a simple algorithm, while others may be slow, like searching through each possible move, discounting the ones that fail and continuing the search until the best possible route is found.
I'm not familiar with the game you mention (despite being into puzzles and the Amiga). Can you post some links and screenies? A video might help too.
Without knowing the game, I'm really sure exactly what you are asking for help with. How can you write code that will solve something if you yourself can't solve it?
I'm a dab hand with puzzle games and have written a fair few over the years (B'lox!, Guru Logic Champs, Sokoban, Ken2X, SuQo, CatTrap, Picross and several others) and have others in development - Puzzimals and Ootopia.
I'd be willing to help you out, but would need a bit more info first.
I would not know how to solve, but bumped into a similar problem when trying a top view race game...
how to make sure the AI cars comprehend the track and race? The track must be editable.
So maybe marking target point on the track? could be a core?
Really tough to do AI, but I find one of the most pleasurable things on programming when you do it.
I once wrote a streetfighter game, the opponent AI would look into it´s energy gauge so as yours and would also move between 3 distances from the player as to find the best attack approach, it was quite complex but easy in comparison to your problem.
I was so happy to see the AI taking choices and moving as it was alive... :'(
Everybody who has GLB has a copy of the game, Open up the online help & select the 1st option (Tutorials) & its the one labelled "The First Game".
I have wrote code in the past that solves puzzles, but only when I knew how to solve them myself.
BTW I take no responsibility for any anger issues or frustration that may arise from you trying the game out :D
Quote from: Ian Price on 2011-Nov-02
Without knowing the game, I'm really sure exactly what you are asking for help with. How can you write code that will solve something if you yourself can't solve it?
My fault for not making myself too clear Ian. The help I require is in how I can solve the game. Once I know how to do it then I can program a routine that can work out the minimum amount of moves it can be achieved in.
Sorry :noggin:
Lee
Ahh, I know that game as "Lights Out" You basically place a symbol on the board (generally a 3x3 cross/diamond/square) - if an element of the board beneath the symbol was lit, then un-light it, otherwise light it. Once all lights are lit/unlit (depending on the original game aim) then the game/level is won.
It's a very simple concept and creating a routine where the pc can solve the puzzle shouldn't be too complex, although will require lots of recursion with the map data.
Info about the handheld game can be found here - http://en.wikipedia.org/wiki/Lights_Out_%28game%29
Quote from: Ian Price on 2011-Nov-02
Info about the handheld game can be found here - http://en.wikipedia.org/wiki/Lights_Out_%28game%29
Thanks Ian you are a Life saver :nw: .
Know I now how to play it the pc solution to solving it is so easy its unreal. Basically it is the reverse order that the game plots each level & if the pc plots 5 items then 5 clicks are all that required to solve it.
Because I didn't understand the rules on how to play it originally (my mis-interpreting the help file) that was the cause of my problem :)
D'oh - I was looking at it as if the computer didn't know how it plotted the lights (as if the puzzle was ported in to it).
Obviously if the computer plotted the puzzle then your solution is indeed correct and piss-easy.
No, if you dont change the NewLevel-sub, shortest solution is most times level+1. But not in every case, e.g. its possible that the computer 'clicks' two (or more) times in a row at the same position, in this case your the shortest solution is a smaller number. Of cause you can change the sub to prevent the computer from clicking on some position repentantly, but you should only prevent it, if none of the five fields, that belong to this position, got changed since the last click at this position.
Hope my English dont prevent you from understanding, what im trying to say. :S
You are indeed correct and perfectly understandable :)
It is also possible that the computer clicks on the same space (non-consecutively (as opposed to your consecutively)) that has not been altered by other clicks, thereby negating itself. It would therefore be prudent to prevent this too, by preventing the computer from clicking on any space twice.
I would not completely prevent it from clicking same position twice:
If it clicks (3,4) -> (5,4) -> (3,4), it wont negate one click (think about the field (4,4)!), but would make the game bit more difficult and interesting. So i would allow it to do it this way. But of cause a (3,4) -> (6,8) -> (3,4) should be allowed.
You mis-read what I posted. I stated if any points of the original click "has not been altered by other clicks" - don't allow this.
Ah so we're saying the same. So lets hope it was useful for fuzzy. ;)
Btw the question how to solve this, if you dont know how it was created, is still interesting. I like thinking about creating AI, but its totally unnecessary in this case. That is an important lesson, that every (new) programmer has to learn: dont make things complicated!
Basically prevent it from doing the same position one after the other, nice & easy to do. If current random x/y = previous random x/y then roll again.
Like I said in my original post, expanding an existing "Basic" framework will allow me to learn GLB a lot better than just picking a command & playing with that. At least I will have a goal or target to use the commands with. Even if they only make it into the title screen or such I feel that a place will be found to use most the commands.
My main aim is to learn GLB features & syntax. common/basic loops, branching etc are pretty well under my belt from many years of basic programming :good:
Quote from: kanonet on 2011-Nov-02
Ah so we're saying the same. So lets hope it was useful for fuzzy. ;)
It was very useful & thanks to all that posted, Especially Ian for the links so I understood how to play the game, I didn't quite get the idea of it from the help file lol
Soz for the double post, just answered & noticed a new one had been posted lol.
Quote from: kanonet on 2011-Nov-02
Ah so we're saying the same. So lets hope it was useful for fuzzy. ;)
It was useful Kanonet & thanks to all that helped in this matter. All I needed was to understand the rules of the game which in the help file was not overly clear. Thanks to Ian's links I now understand the game & the solution is so easy that I wouldn't even class it as needing AI, Just a nice simple NoOfClicksNeeded = Level+1 :D
Basically prevent it from doing the same position one after the other, nice & easy to do. If current random x/y = previous random x/y then roll again.
Like I said in my original post, expanding an existing "Basic" framework will allow me to learn GLB a lot better than just picking a command & playing with that. At least I will have a goal or target to use the commands with. Even if they only make it into the title screen or such I feel that a place will be found to use most the commands.
My main aim is to learn GLB features & syntax. common/basic loops, branching etc are pretty well under my belt from many years of basic programming
Quoteasically prevent it from doing the same position one after the other, nice & easy to do. If current random x/y = previous random x/y then roll again.
Yes and no! Don't allow it to consecutively use the same space (ie twice in succession), but also don't allow it to use the same space if no other click has affected the first click at a later time, as this would still negate the original click.
See this example -
(Purple indicates where to place click. Green shows results of earlier click)
In figure 1 - In the third pic it's OK to use the same space
In figure 2 - In the third pic it shows that you shouldn't use the same space.
So you need to when when it's OK to use the same space and when it's not.
[attachment deleted by admin]
Please excuse my previous few posts, my browser seemed to have a bad moment & said it had posted then said it hadn't :S
I see what you mean, my previous example to the solution was worded just a bit to simply, although I did understand what was posted prior.
Sort of like an extra "this has been plotted & not affected another" type flag & check against that
haha. The game was in a compilation called "Logo" in Germany had featured some rendered images ... ah, never mind.
Quote from: Kitty Hello on 2011-Nov-03
haha. The game was in a compilation called "Logo" in Germany had featured some rendered images ... ah, never mind.
I know as I downloaded the Amiga version, didn't help at the time as the docs are in German :D