Download CSE 331 – Data Structures Project: ollehtO Developed By

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Ecological interface design wikipedia , lookup

Artificial intelligence in video games wikipedia , lookup

Computer Go wikipedia , lookup

Transcript
CSE 331 – Data Structures
Project: ollehtO
Developed By:
Team Awesomeness
Travis Clark – Interface
Matt Tanner – Interface/Testing
Patrick Davis – AI
Lance Gallop – Core Logic
Project Details


Motivation:
Implement an
attractive console
version of the popular
game Reversi.
Audience: Strategy
gamers who happen
to like (or are forced
to use) consoles
games.

Goals:
• Functional,
attractive, and
intuitive UI
• Highly Structured
Coding Style
• Varying degrees of
AI strength
• Show off the Power
of Ncurses.
Why use Ncurses?
Why Climb Everest? Because It’s There. And…
BECAUSE
GRAPHICS ARE
FOR THE WEAK!
Program Capabilities
• Runs on any platform capable of supporting
the curses library (Linux, possibly OS X).
Mouse input is supported if supplied by the
terminal.
• Either player can be a human or computer
opponent.
• Computer opponents have five levels for
artificial intelligence, from random moves to
complex depth searches.
• Unlimited support for the undo command
allows games to be retraced and altered.
• Multiple color schemes ranging from “Field of
Dreams” to “Stalin’s Nightmare”.
Program Compartmentalization
• One of the major project goals was
maintaining a high degree of structure and
modularity. Ollehto was developed in three
separate (but related components): Ncurses
engine, game engine, and AI engine.
Abstraction Barriers
• Ncurses engine: responsible for event capture,
event processing, and board display. Human
interface to Game Objects.
• Game Engine: responsible for maintaining
game state, receiving Ncurses input. Contains
Board and AI objects.
• AI: Determines computer moves. (Black Box)
Classes and Their Data Structures
• Board – Stores board state, calculates validity
of moves, and provides carefully controlled
board interface.

Vector – fixed size needs and constant access time.
• History – Records moves and accommodates
undo function. Very rigid interface, similar to a
stack.

Deque – needed to maintain queue like order, but
add and remove from the rear and traverse from the
front.
• Game – Runs a game of ollehtO, turn by turn
• AI – Determines all possible moves using the
Board class and returns the “best” one.

Vector – used as temporary storage container.
AI Algorithms

AI::getMove() – Uses several
different methods to choose the best
move.
• Level
• Level
• Level
• Level
• Level
1:
2:
3:
4:
5:
Random Selection
Greedy Algorithm
Weighted Greedy
Complex Weighted Greedy
Min-Max Depth Search
Other Data Structures & Performance Issues



Vectors: Used in Board class for constant
access time. There were no insert or
deletes, only accesses. Used in the AI to
speed random access.
Deques: Used in History class. Double
linking was essential for the behavior
desired.
Sets and List: Used to determine possible
moves. Sets are used because of their
efficient membership test, lists are used
as a temporary storage for their efficient
inserts.
Final Thoughts




We can now do things with Ncurses that
God never meant for man to do.
Compartmentalization works very well if it
is carefully planned.
To attain various levels of AI, a toolkit of
different algorithms is necessary.
Abstractions barriers work.
And Now: The Demo
A Moment of Zen