Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Reversi (AKA Othello) Module Complete
Started by roaminggamer Feb 21 2018 02:57 PM

6 replies to this topic
release
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,673 posts
  • Corona SDK

Inspired by the discussion HERE, I made a module for creating any size Reversi board and an extensive demo showing how to use it. 

 

Note: The module does NOT rely on SSK, but the demo does.

 

Note 2: This module is not based on the discussion noted above.  It is entirely new code written by myself.  

 

It is coming to the marketplace soon and is available now from Sellfy.

 

If you have and Android device you can play the demo to check it out: 

https://github.com/roaminggamer/RG_FreeStuff/raw/master/Demos/Reversi.apk

 



[TOPIC: post.html]
#2

Appletreeman

[GLOBAL: userInfoPane.html]
Appletreeman
  • Contributor

  • 453 posts
  • Corona SDK

@roaminggamer, Just out of interest how did you implement the computer AI?  I was looking into the best ways of doing it and everything was pointing towards using the minimax algorithm and alpha/beta pruning - which I kind of understand, but would have no clue at all how to begin implementing it.



[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,673 posts
  • Corona SDK

The use of the term AI quite generous when applied to my approach.

 

Essentially I did this before each player's 'turn':

 

1. Scan board for current player's pieces.

2. Using those pieces, scan for all legal moves. 

  - During this scan, count the number of opponent chips that will be flipped/swapped.

  - Mark legal cells with the swap count.  (Look at video.  See those counts?  That is the easy/medium mode showing the value of a move.)

3. Accumulate list of legal moves for current player this round and return it. 

  - This is a list of empty cells that can be 'clicked'.

  - List is sorted from most flips/swaps to fewest.

 

Then, if the computer is playing, use this logic:

  • Dumb AI - Choose lowest value move.
  • Smart AI - Choose highest value move.
  • Medium AI - Choose random move.

In point-of-fact, to be truly intelligent, the move algorithm would need some strategic parts:

  • Corner capturing emphasis.
  • Multi-turn advance planning and evaluation
  • Blocking
  • etc.


[TOPIC: post.html]
#4

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,673 posts
  • Corona SDK

For anyone thinking about getting my module, not happy with the AI please note you can find free online Reversi AI algorithms and convert them to Lua.

 

Then, each turn you can:

 

1. Extract the board layout using the modules built-in get function.

2. Convert that layout to a format suitable for consumption by the AI code.

3. Run the AI code.

4. Apply the 'winning move' just as I do, but not resulting from your far superior AI code.
 

My module is less about AI and more about a flexible board layout and play mechanism.



[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,673 posts
  • Corona SDK

Note: I must be time travelling.  :)   

 

As I type this, the post by @Appletreeman says it was posted 

 

Today 12:34 AM

 

My answers are:

 

Today 10:27 AM and Today 10:33 AM



[TOPIC: post.html]
#6

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,424 posts
  • Corona SDK

This game is right up my alley. Perfect. Thank you!



[TOPIC: post.html]
#7

sirmania

[GLOBAL: userInfoPane.html]
sirmania
  • Contributor

  • 154 posts
  • Corona SDK

Interesting!

 

Maybe you can create the new Alpha Zero. I watched the Alpha Go documentary. Super interesting stuff.

I have by the way sent you a mail about a new boardgame AI  ;)




[topic_controls]
[/topic_controls]