blob8108 wrote:
Well, again, you have managed to convince me of something, though I'm not sure exactly what yet... maybe it'll come to me as I write out this reply.
...
What you're suggesting is that each player is a "Bob", so to speak. The AI doesn't need to know who it's playing for, it just needs to play for top-to-bottom. The problem I see there is that how does it know which pieces it put down? Unless you always put down a 1 and all pieces are negated each time behind the scenes, but that sounds rather ugly in my opinion.
Correct — it knows that all its pieces are +1 pieces; as you said the top-to-bottom player is +1. And the placing of the pieces would be handled by the framework, as the function just returns the co-ordinates, I thought.
Hmm.
I guess that is a quite interesting way to look at it then; it's sort of the way each Chess player sees his pawns moving forwards, and sees the opponent's pawns move backwards. So by both flipping the pieces and rotating the board I am actually setting it up such that each player plays White (I'm continuing with the Chess analogy; I still agree with +1 and -1 pieces rather than "R" and "B"). This sounds great — the AI only really needs to implement putting in a piece going vertically. My problem is rotation: should the rotation only rotate clockwise? Or should it alternate clockwise and counter-clockwise? If so, how will a recursive AI know in which direction it should rotate it? If it rotates the wrong way, wouldn't the board sort of flip? Wouldn't that ruin many runtime optimizations? There are just so many problems which crop up as soon as you mention rotation, it really puts me off the idea. Also, as a minor quibble, negating each piece is kinda expensive and still seems ugly to me.
Offline
Hardmath123 wrote:
blob8108 wrote:
Hardmath123 wrote:
What you're suggesting is that each player is a "Bob", so to speak. The AI doesn't need to know who it's playing for, it just needs to play for top-to-bottom. The problem I see there is that how does it know which pieces it put down? Unless you always put down a 1 and all pieces are negated each time behind the scenes, but that sounds rather ugly in my opinion.
Correct — it knows that all its pieces are +1 pieces; as you said the top-to-bottom player is +1. And the placing of the pieces would be handled by the framework, as the function just returns the co-ordinates, I thought.
Hmm.
I guess that is a quite interesting way to look at it then; it's sort of the way each Chess player sees his pawns moving forwards, and sees the opponent's pawns move backwards. So by both flipping the pieces and rotating the board I am actually setting it up such that each player plays White (I'm continuing with the Chess analogy; I still agree with +1 and -1 pieces rather than "R" and "B"). This sounds great — the AI only really needs to implement putting in a piece going vertically.
Yup.
My problem is rotation: should the rotation only rotate clockwise? Or should it alternate clockwise and counter-clockwise? If so, how will a recursive AI know in which direction it should rotate it? If it rotates the wrong way, wouldn't the board sort of flip? Wouldn't that ruin many runtime optimizations? There are just so many problems which crop up as soon as you mention rotation, it really puts me off the idea.
Why not rather than rotation, just flip the x/y values? ie., a reflection in y=x. The point [2,3] goes to [3,2], for example.
Also, as a minor quibble, negating each piece is kinda expensive and still seems ugly to me.
...but not that expensive. *I* think it's quite a nice way of doing it...
Offline
roijac wrote:
let's go for R&B, ok?
the algorithm only has to calculate the best place for red pieces, playing top-down. but i think empty should be empty string, not '-' (bool check)
Empty will be 0.
Offline
No. But I like -1, +1, and 0. What have you got against it?
Offline
amcerbu wrote:
Char takes up less memory than int and short.
I didn't think JS had a char type... Perhaps a "byte" one, unless I misremember?
Offline
roijac wrote:
amcerbu wrote:
Char takes up less memory than int and short.
come on, it's not a commodor64 we're programming on
Haha, true. I guess a byte type would work (although you'd have to make sure it wasn't unsigned if you wanted -1, 0, and 1).
Offline
amcerbu wrote:
roijac wrote:
amcerbu wrote:
Char takes up less memory than int and short.
come on, it's not a commodor64 we're programming on
Haha, true. I guess a byte type would work (although you'd have to make sure it wasn't unsigned if you wanted -1, 0, and 1).
var...
Offline
Amcerbu, are you a C coder? Because you really ought to learn JS, it's a great language for this sort of thing (where the algorithm is more important than the actual coding).
P.S. You can get rid of the Xenon banner, I don't think we need it anymore...
Last edited by Hardmath123 (2012-05-19 00:34:04)
Offline
UPDATE
After a really cool discussion with Blob and roijac, where he offered lots of suggestions; and a lot of daydreaming at home, here's the new and improved Framework plan:
As before, the framework will be a HexBoard object, where the contents property is a 10x10 array with either -1, 0, or +1. When your AI function is called, it will be given a HexBoard such that your pieces are +1 and the opponents' are -1. Blank cells are 0. Don't worry about how that would work, that has caused a lot of confusion earlier on the topic, and now that I think I have figured it out, I don't need to get lost again. You need to return a X/Y coordinates of where you need to place your piece (Again, thanks to a discussion with Blob. I personally favor returning a brand new HexBoard with the new piece put on, but he somehow managed to convince me otherwise. Ask him why, I seem to have forgotten.) You need to move so that you make a chain connecting top-to-bottom. My back-end will handle everything else.
The framework will be out by June 1, I'm working on it. It will have a flip board function and a function which checks if you can move to a particular cell. It might have a whoWon function by then, but I'm not sure I'll have the time.
The IDE will be out a few days after the framework because I'm still working on the GUI and haven't even started in the back-end.
Offline
Hardmath123 wrote:
P.S. You can get rid of the Xenon banner, I don't think we need it anymore...
lol yeah xenon... i remember when i was a noob and got mad on you of not letting me in so i made graphs in about a week
Offline
roijac wrote:
Hardmath123 wrote:
P.S. You can get rid of the Xenon banner, I don't think we need it anymore...
lol yeah xenon... i remember when i was a noob and got mad on you of not letting me in so i made graphs in about a week
Oh yeah.
Sorry about that, by the way. I was just sore from Chrono Wars.
Offline
Gah!I feel like crying!
I was done with most of the framework: the flipping, who won (that was lots of fun to code), and a better drawing with real hexagons. I was editing in Xcode, which is awesome if you code a lot. Unfortunately I had another Xcode project (a Mac app for animation) open which due to a silly mistake glitched. The glitch made Xcode crash (that's the first time that happened to me, by the way) and it took all my changes with it. Grr.
I'm sorry guys, but I really don't feel like rewriting all that code, so I'm not doing this framework. Either someone else can take over or we can decide on another competition or we can abandon this entirely, but the framework is not coming back. It's a shame it got lost just like that, I worked hard on it. I literally cut the code to paste it into my "safe copy" when Xcode crashed taking both the pasteboard data and my edits.
I guess I learned something though: never experiment with objective C memory management when another window has precious data.
EDIT: Since we are hopelessly framework-less, but everyone is still (I hope) kind of excited about the tournament, would you guys like to suggest something else we could do instead? Maybe a run-of-the-mill constrained programming challenge (like you have to code something within 500 characters)? I'm really disappointed it didn't work out and I made this huge thread with 6 pages just to blow it by forgetting to deallocate an NSArray.
Last edited by Hardmath123 (2012-05-26 05:23:55)
Offline
Nooo! Don't give up! D: *sadface*
—I'll rewrite the framework! It sounds fun; and you won't have to deal with me constantly telling you how you should do it.
(Without trying to annoy: this is why you should use version control. It makes my head hurt sometimes, but the reassurance of knowing all the changes are saved there, somewhere, is lovely... you have to have commited the changes, of course. )
Then again, it seems crazy to me that it isn't saved anywhere. Are you sure it hasn't saved it to a temporary file somewhere, or something?
(Also, you should check out Alfred. As well as being an awesome Spotlight replacement, it includes (nearly) unlimited clipboard history, which is sooo useful.)
Could you send me any code you do still have? — I think you posted a UI a few pages back? I'll have a look...
Last edited by blob8108 (2012-05-26 05:53:42)
Offline
blob8108 wrote:
Nooo! Don't give up! D: *sadface*
—I'll rewrite the framework! It sounds fun; and you won't have to deal with me constantly telling you how you should do it.
(Without trying to annoy: this is why you should use version control. It makes my head hurt sometimes, but the reassurance of knowing all the changes are saved there, somewhere, is lovely... you have to have commited the changes, of course. )
Then again, it seems crazy to me that it isn't saved anywhere. Are you sure it hasn't saved it to a temporary file somewhere, or something?
(Also, you should check out Alfred. As well as being an awesome Spotlight replacement, it includes (nearly) unlimited clipboard history, which is sooo useful.)
Could you send me any code you do still have? — I think you posted a UI a few pages back? I'll have a look...
Zilch. You see, I'm normally hyper-paranoid about these things. If you've seen me write JS, you'll know what I mean: I literally press command-s six times just to be safe. I never delete code, I practically always comment out what I don't need, then do a huge comment-removal session every few days.
This time around, I was editing my JS in Xcode (because it's the best code editor I have). Usually to test code, I wrote myself this cool little app which you can paste JS in and test out. That helps me avoid clearing my cache every time I increment a variable. I just copy and paste in the JS and it runs it for me on a UIWebView. I accidentally command-x'ed instead of command c-ing. So the code was cut out onto my clipboard. Then, before I got to think, Xcode went bonkers and it saved an empty .js file and cleared my clipboard (which I found crazy, but hey; I always found Objective-C mysterious)!
It's awfully nice of you to offer to help rewrite the framework! But there are a couple of things nagging me: it's May 26th so you have 5 days, and you're gonna be taking part so it doesn't seem to fair for you to be writing the code (not that I doubt you, but if you won...). Also, writing a whole AI is a rather daunting task, and although you're so thrilled, I'm not sure others would like to face this (it's a lot of code if you want a good AI). If you see the first few pages, you'll find a couple of posts saying "If I were better at JS..." or "If I had the time...". This makes me think maybe a lighter-weight competition might be better; looking both at the amount of work both we and the competitors want to do. Some lighter-weight competitions are, as I mentioned earlier, simple constrained coding competitions. I was quite thrilled about this Hex game, but it just seems like too much right now.
But if you insist... ( ) here are the things you need to know to rewrite the framework: I made practically no changes to the UI (save for wording, minor tweaks to colors/measurements to my box models) so just edit what I posted. You'll need to rewrite the HexBoard.js file. Feel free to make your own or just give up, I'm fine either way. Thanks again!
Offline
Hardmath123 wrote:
Zilch. You see, I'm normally hyper-paranoid about these things. If you've seen me write JS, you'll know what I mean: I literally press command-s six times just to be safe. I never delete code, I practically always comment out what I don't need, then do a huge comment-removal session every few days.
This time around, I was editing my JS in Xcode (because it's the best code editor I have). Usually to test code, I wrote myself this cool little app which you can paste JS in and test out. That helps me avoid clearing my cache every time I increment a variable. I just copy and paste in the JS and it runs it for me on a UIWebView. I accidentally command-x'ed instead of command c-ing. So the code was cut out onto my clipboard. Then, before I got to think, Xcode went bonkers and it saved an empty .js file and cleared my clipboard (which I found crazy, but hey; I always found Objective-C mysterious)!
It's awfully nice of you to offer to help rewrite the framework! But there are a couple of things nagging me: it's May 26th so you have 5 days
That's not an issue. I have lots of time over the next few days...
Also, writing a whole AI is a rather daunting task, and although you're so thrilled, I'm not sure others would like to face this (it's a lot of code if you want a good AI). If you see the first few pages, you'll find a couple of posts saying "If I were better at JS..." or "If I had the time...". This makes me think maybe a lighter-weight competition might be better; looking both at the amount of work both we and the competitors want to do. Some lighter-weight competitions are, as I mentioned earlier, simple constrained coding competitions. I was quite thrilled about this Hex game, but it just seems like too much right now.
Darn, you're right. How about a tic-tac-toe/noughts-and-crosses AI? Or something new entirely. And simpler. I dunno...
Last edited by blob8108 (2012-05-26 06:46:51)
Offline
blob8108 wrote:
Hardmath123 wrote:
Zilch. You see, I'm normally hyper-paranoid about these things. If you've seen me write JS, you'll know what I mean: I literally press command-s six times just to be safe. I never delete code, I practically always comment out what I don't need, then do a huge comment-removal session every few days.
This time around, I was editing my JS in Xcode (because it's the best code editor I have). Usually to test code, I wrote myself this cool little app which you can paste JS in and test out. That helps me avoid clearing my cache every time I increment a variable. I just copy and paste in the JS and it runs it for me on a UIWebView. I accidentally command-x'ed instead of command c-ing. So the code was cut out onto my clipboard. Then, before I got to think, Xcode went bonkers and it saved an empty .js file and cleared my clipboard (which I found crazy, but hey; I always found Objective-C mysterious)!It's awfully nice of you to offer to help rewrite the framework! But there are a couple of things nagging me: it's May 26th so you have 5 days
That's not an issue. I have lots of time over the next few days...
I have the next week free, too.
Also, writing a whole AI is a rather daunting task, and although you're so thrilled, I'm not sure others would like to face this (it's a lot of code if you want a good AI). If you see the first few pages, you'll find a couple of posts saying "If I were better at JS..." or "If I had the time...". This makes me think maybe a lighter-weight competition might be better; looking both at the amount of work both we and the competitors want to do. Some lighter-weight competitions are, as I mentioned earlier, simple constrained coding competitions. I was quite thrilled about this Hex game, but it just seems like too much right now.
Darn, you're right. How about a tic-tac-toe/noughts-and-crosses AI? Or something new entirely. And simpler. I dunno...
Tic-Tac-Toe can (and will) have ties.
Offline
HardMath123 wrote:
blob8108 wrote:
HardMath123 wrote:
Also, writing a whole AI is a rather daunting task, and although you're so thrilled, I'm not sure others would like to face this (it's a lot of code if you want a good AI). If you see the first few pages, you'll find a couple of posts saying "If I were better at JS..." or "If I had the time...". This makes me think maybe a lighter-weight competition might be better; looking both at the amount of work both we and the competitors want to do. Some lighter-weight competitions are, as I mentioned earlier, simple constrained coding competitions. I was quite thrilled about this Hex game, but it just seems like too much right now.
Darn, you're right. How about a tic-tac-toe/noughts-and-crosses AI? Or something new entirely. And simpler. I dunno...
Tic-Tac-Toe can (and will) have ties.
Darn. Hadn't thought of that. Hmm...
Offline
What if we all just take a fresh start and go with something like Reversi/Othello, or Go? I'm sorry about that, Hardmath. By the way, does anyone know if you can use Visual Studio to program in JavaScript?
Offline
Offline