Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

04-15-2017 , 08:45 PM
I wonder what the minimal human-like instruction set for no-lose tic-tac-toe is. Something like this is close...probably a bit more work needed.
1. Play in the middle
2. Play tic-tac-toe
3. Block an opponent's tic-tac-toe
4. If you're opponent controls opposite corners, don't play in the corner; else, play in a corner.
5. Threaten tic-tac-toe
6. Random move
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-15-2017 , 09:17 PM
I would be supremely interested in that.

Tic-tac-toe bot golf sounds like it should be a thing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 03:14 AM
gm, I'd be interested in that kind of thread.

As an aside, this reminds me of this series. They start with the idea of why Tic Tac Toe is flawed, then convert to all X's. introduce another variation, then go on and on to some interesting game theory stuff, simplifying the problems space to smaller and smaller pieces.

https://www.youtube.com/watch?v=ktPv...ature=youtu.be

https://www.youtube.com/watch?annota...&v=h09XU8t8eUM

Think it's pretty cool stuff for programming type stuff.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 12:45 PM
Quote:
Originally Posted by Sholar
I wonder what the minimal human-like instruction set for no-lose tic-tac-toe is. Something like this is close...probably a bit more work needed.
1. Play in the middle
2. Play tic-tac-toe
3. Block an opponent's tic-tac-toe
4. If you're opponent controls opposite corners, don't play in the corner; else, play in a corner.
5. Threaten tic-tac-toe
6. Random move
I built something like this a couple of years ago for a class. In our version the computer player was always Os. Here's my instruction set:

Move 1 - If the center is open, take it. Otherwise play a corner.

Move 2 - If X is one move away from a win, block it. Otherwise:
If there's an X in the center, play a corner.
If there's an X in two corners, play a side.
Else, play a corner adjacent to an X.

Moves 3 and 4 - If O has a winning move, take it. Otherwise block X from
winning.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 01:58 PM
Yeah, that seems identical to my 1-4. The only complicated rule in both cases is to avoid the one and only "trap" in tic-tac-toe, which is playing one of the ? spots in this position.
Code:
X - ?
- O -
? - X
Those rules don't exploit inferior play by the opponent, though. For the computer, just brute-forcing the entire space is pretty direct, interesting to ask how much you can compress that, though it would be more so if the game were a little more nuanced :-)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 03:39 PM
This was probably overkill, but I wrote minimax ai solver for tic tac toe a while back, it was a lot of fun and still very informative despite this specific games simplicity.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 04:36 PM
Othello is a much funner exercise to learn basic ai imo.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 04:49 PM
Quarto is pretty interesting for this too: https://en.m.wikipedia.org/wiki/Quarto_(board_game)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 06:50 PM
Quote:
Originally Posted by toddw8
Move 1 - If the center is open, take it.
99.99% sure that's the wrong move! Always open in a corner.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 07:20 PM
Quote:
Originally Posted by Gullanian
99.99% sure that's the wrong move! Always open in a corner.
Optimal strategy allows for an open in either the center or a corner
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 07:59 PM
Optimal strategy includes a random first move (for the first player): it's all drawn.

Opening in the corner is "better" only because it gives you a chance to win against people who only calculate one move deep (by playing for the above position).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 08:32 PM
Quote:
Originally Posted by toddw8
I built something like this a couple of years ago for a class. In our version the computer player was always Os. Here's my instruction set:

Move 1 - If the center is open, take it. Otherwise play a corner.

Move 2 - If X is one move away from a win, block it. Otherwise:
If there's an X in the center, play a corner.
If there's an X in two corners, play a side.
Else, play a corner adjacent to an X.

Moves 3 and 4 - If O has a winning move, take it. Otherwise block X from
winning.
I think this is flawed where you could make a move in both corners and then a corner in between. I think possibly all you would need is something like you wrote and the ability to distinguish moves that then give them 2 chances to win.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-16-2017 , 08:55 PM
"If there's an X in two corners, play a side." should handle that case.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-17-2017 , 06:50 AM
If you start with the center, the rest is simple, and the "AI" wouldn't even have to be aware of the entire board at any moment.

So, if you start like this:

Code:
_ _ _
_ O _
_ _ _
The player "should" do this (though my idea works no matter where they play):

Code:
X _ _
_ O _
_ _ _
Your strategy is to find the last empty slot of the array, using rotations to convert as you need.

if you number the board like this:

Code:
[1 2 3
4 5 6
7 8 9]
if player plays at 1, you find the last empty slot on [1 2 3], or if player plays at 3, find the last empty slot at [3 6 9], if 9, then [9 8 7], if 7, [7 4 1].

If 1 and 3 are filled out on [1 2 3], then you would find the last empty, which is 2. The rest of the arrays work the same, but perhaps some math would help with this. Building a function that checks of +3, -3, +1, -1 are valid for any array, wouldn't be too difficult to create.

It's going to tie after 2 moves I think, so can probably just randomly play after that. You don't need to solve the entire game tree as long as you know when a tie is guaranteed.

I haven't put much thought outside of playing the center first. Well.. haven't put a lot of thought into this at all, but this is how I'd start.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-17-2017 , 07:41 AM
If Alice goes first (and plays in the center) Alice can make a random second move and still be OK. Is there even a way for Bob to win if Alice just blocks any 2-in-a-rows?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-17-2017 , 09:29 PM
So just for ****s and giggles after listening to you fine gentlemen I am halfway through this 10 week program. I can say that my level of learning due to immersion and direct guidance is exponentially more than what it would have been doing the slow self study route. None of this comes from other students though. I am still honestly very thoroughly shocked as to what exactly is going on through their mind when they signed up for the course. I am also still very much wondering how the school comes in and makes an effort to maintain a certain benchmark performance from each student when at times the teaching staff is essentially handing over answers to certain students. Of the few gems from my cohort:

1. man introduces himself "hey guys I am a web developer for five+ years looking to better understand newer technologies." Great! I think this guy will be a source of knowledge only to find out he has a hard time starting up the terminal (even at 5 weeks in), inspecting HTML and JS files, and other random things which 5 years in makes you wonder what exactly were you working/selling to clients.
2. A self proclaimed "nerd" who after 5 weeks in still has to ask what pwd does (after being told daily what the command does). This man is always stalling with the prior week's homework questions, perpetually interrupting class and making snarky remarks like he knew the answer to his question after he is given an answer.

I have more horrid examples of people paying over $10k for this service yet appear to not give a flying f*** as to them putting any effort into it. There's maybe one woman honestly trying and constantly coding and trying to put her best foot forward to better understand this. That and wtf is agile for if your "blockers" are a combination of ("too tired to do homework", "this is all going to fast", "I went out with friends last night so I'm behind"). At the end of the week the school is actively trying to better itself and get feedback and I always feel terrible about pointing out the obvious pain points. During the agile "retrospection" sessions I clearly point out that one purposely lazy student shouldn't stall the class at the sacrifice the other student's time. I really wonder how it is that they will be able to give their stamp of approval to over half the class considering many still have a hard time doing a simple loop.

Btw, I'm no boy genius and I barely touched a computer in the last 10 years of my life but damn it's simply amazing what anyone is able to accomplish if you just try just a little bit.

Last edited by whb; 04-17-2017 at 09:41 PM. Reason: Better and more concise rant
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-17-2017 , 11:26 PM
One nice thing about going the machine learning route is just how many resources are out there for free. What began as a passing interest to me became a small fun hobby to study as it combined several interests of mine, to becoming a full on obsession.

I think without the level of quality instruction and near unlimited resources I would have not got into it to this degree, and now I spend free time reading the never-ending firehose of research papers and enjoying it immensely. The only real issue is having numerous interesting directions to parcel out time and effort.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 03:16 AM
Quote:
Originally Posted by whb
I really wonder how it is that they will be able to give their stamp of approval to over half the class considering many still have a hard time doing a simple loop.
Way back when I did my degree (graduated in 2001), which was at the most well-regarded university in my city, I would estimate that something like a third of the graduating class had no idea how to program whatsoever. I mean they could probably do loops, but give them a real world problem and they'd go to pieces.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 07:01 AM
I support daveT and his use of "AI" to accurately describe what is going on here.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 08:16 AM
For cookies, most browsers let you accept cookies from the site you're on and block cookies from third parties. Does the same functionality exist in an add on or plugin for JavaScript? Would be nice to always allow JavaScript either from the domain you're on or a white list, such as wherever jquery is usually hosted, and block everything else.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 09:01 AM
NoScript.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 10:38 AM
So, long story short, I've managed to get a final round face to face interview with Cisco for a graduate role, I recognise that opportunities like this are very hard to come by, so I'd really like to do well, they told me that they will be testing me on 'white board stuff', so whats the best way to prepare for these sort of thing in a week? and any advice at all? (this is my first face to face job interview)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 11:22 AM
Find a friend or professor who will interview you to get used to answering questions about yourself and your experience. There must be a list of common white board questions on the internets that you can practice with.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 11:34 AM
Actually do the practice white board questions on a piece of paper or whiteboard though. If you're going to have to do it in the interview, it's good to practice and get use to the awkwardness.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-18-2017 , 11:35 AM
Yeah, if you don't have experience talking out ideas to people now would be a good time to practice that too.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m