[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Is there a way to represent a turn based game, with a finite,

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 41
Thread images: 27

File: IMG_0916.png (6KB, 640x480px) Image search: [Google]
IMG_0916.png
6KB, 640x480px
Is there a way to represent a turn based game, with a finite, discrete number of moves, as a graph?

Or what other forms of analysis can you use?

Let's use a mini version of the connect 4 board as an example. Say it is 3 columns by 5 rows, rules are that each player can pick x:{1,2,3} and that assigns them the coordinate (x,y) where y is the minimum y:{1,...,5} such that (x,y) does not already exist (just think about regular connect 4 rules if that confused you, the pieces stack on each other).

I enjoy turn based games, but I don't know a good way to analyze decision trees for them.
>>
File: 4chan3.png (95KB, 250x187px) Image search: [Google]
4chan3.png
95KB, 250x187px
>>
File: 1503681468399.png (109KB, 250x187px) Image search: [Google]
1503681468399.png
109KB, 250x187px
>>9128576
>>
>>9128524
yes, in your example each move can simply described by the x-coordinate.

So a game can be described as a tuple (x1,x2,x3,x4,x5,x6,x7,...,xn) where the first player choses the odd components and the second player the even components.

A condition for admissible sequences is that the number of entries for each x is at most 5.

So you can describe all possible moves from a given sequence by adding a component say x(n+1) and assigning it any possible value.
>>
File: Untitled.png (93KB, 250x187px) Image search: [Google]
Untitled.png
93KB, 250x187px
>>9128610
>>
File: 1503691131503.png (107KB, 250x187px) Image search: [Google]
1503691131503.png
107KB, 250x187px
>>9128854
>>
File: 1503691557385.png (44KB, 167x125px) Image search: [Google]
1503691557385.png
44KB, 167x125px
>>9128871
>>
File: Untitled.png (41KB, 167x125px) Image search: [Google]
Untitled.png
41KB, 167x125px
>>9128897
>>
>>9128524
>Is there a way to represent a turn based game, with a finite, discrete number of moves, as a graph?
my first year compsci class touched a bit on this in a homework assignment, this may be the naive answer.
any game as you described could be represented by a (most likely computationally impossibly huge) tree. if you knew the rules of the game and had infinite computer, you could just build the entire tree and
minmax on the assumption that your opponent will play perfectly. it's recursive because you try to assign a score to every node in the graph
large games are computationally infeasible to do this on, and there are algorithms to prune branches out of the tree to save computation time

for connect 4 in particular the brute force naive solution would just be to construct a massive game tree and ab-minmax it out. too lazy/unfamiliar to think of a better solution right now
>>
>>9128899
fake
>>
File: Sans titre.png (43KB, 167x125px) Image search: [Google]
Sans titre.png
43KB, 167x125px
>>9128899
>>
The naive way would be to represent it as a DAG with every valid board layout as a node with edges connecting nodes that can be moved between with valid moves
>>
File: 4chan4.png (45KB, 167x125px) Image search: [Google]
4chan4.png
45KB, 167x125px
>>9129003
>>
File: 1503698343034.png (37KB, 167x125px) Image search: [Google]
1503698343034.png
37KB, 167x125px
>>9129061
>>
>>9128524
Anon sequences of moves don't matter for this game, only board state. You can represent the state of the game as

struct State
{
Empty = 0,
Red,
Green
}

class Board
{
public:
constexpr std::uint32_t sizeX = 7;
constexpr std::uint32_t sizeY = 6;
State state[sizeX][sizeY];
std::char columnSize[sizeX];

};

You can then define feature extraction methods such as >NumEmptyColums()
>NumRedTopColums()
>NumGreenTopColumns()

Things like this, and you can reason based on this.
>>
>>9129061
I fuckinh hat e sci
>>
File: connect.png (44KB, 167x125px) Image search: [Google]
connect.png
44KB, 167x125px
>>9129066
>>
File: 1503715633197.png (37KB, 167x125px) Image search: [Google]
1503715633197.png
37KB, 167x125px
>>9129407
Just GIVE UP
>>
File: connect.png (43KB, 167x125px) Image search: [Google]
connect.png
43KB, 167x125px
>>9129582
>>
File: 1503723988754.png (36KB, 167x125px) Image search: [Google]
1503723988754.png
36KB, 167x125px
>>9129586
>>
File: connect.png (42KB, 167x125px) Image search: [Google]
connect.png
42KB, 167x125px
>>9129607
>>
File: 1503726139619.png (35KB, 167x125px) Image search: [Google]
1503726139619.png
35KB, 167x125px
>>9129614
2 e c
>>
File: connect.png (41KB, 167x125px) Image search: [Google]
connect.png
41KB, 167x125px
>>9129632
>>
File: 4chan5.png (41KB, 167x125px) Image search: [Google]
4chan5.png
41KB, 167x125px
>>9130187
>>
File: connect.png (41KB, 167x125px) Image search: [Google]
connect.png
41KB, 167x125px
>>9130204
>>
>>9128524
You may want to check out >>>/tg/ also.
>>
File: Untitled.png (40KB, 167x125px) Image search: [Google]
Untitled.png
40KB, 167x125px
>>9130209
>>
File: 4chan6.png (39KB, 167x125px) Image search: [Google]
4chan6.png
39KB, 167x125px
>>9130357
you're officially fucked now, all we need to do now is fill up the most left collom and we'll either have 4 in a row at the 4th or 5th circle
>>
>>9130362
connect 4 is a solved game. if you go first you win
>>
>>9130204
WHY WHY WHY WHY. Far right would have been best

We could have had them. We could have beat the green. But no, "No", says you. "I WANT TO LOSE" you scream.
>>
>>9130385
how would we win from placing it on the far right?
>>
>>9130383
the thing is, people can't look that far ahead in the future
>>
>>9130389
he would have made it a very light red so our opponent wouldnt have seen it in his peripheral vision

a sneak attack, if you will
>>
File: Untitled.png (39KB, 167x125px) Image search: [Google]
Untitled.png
39KB, 167x125px
>>9130362
>>
File: connect.png (38KB, 167x125px) Image search: [Google]
connect.png
38KB, 167x125px
>>9130421
>>
File: Untitled.png (38KB, 167x125px) Image search: [Google]
Untitled.png
38KB, 167x125px
>>9130483
>>
File: connect.png (37KB, 167x125px) Image search: [Google]
connect.png
37KB, 167x125px
>>9130484
You lost.
>>
File: 1468878469056.png (167KB, 290x265px) Image search: [Google]
1468878469056.png
167KB, 290x265px
Today on /sci/ I watched a game of Connect 4 play out. What a great use of my time.
>>
>>9128959
>there are algorithms to prune branches out of the tree to save computation time
yes, if you have defined a heuristic, then branches that start with the worst scores can be ignored as long as other branches exist with better scores--or in some cases can be deleted altogether. the heuristic itself presents a time/space tradeoff. too simple and more space must be used. too complicated, and more time must be used.
>>
>>9129403
>constexpr std::uint32_t sizeX = 7;
sepples babby
>>
File: 4chan8.png (39KB, 167x125px) Image search: [Google]
4chan8.png
39KB, 167x125px
Thread posts: 41
Thread images: 27


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.