Thread: Slots Simulator. Identity Matrix.

  1. #1
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    RING 0

    Slots Simulator. Identity Matrix.

    Hi, just looking for other peoples ideas on how they would go about solving this problem Right now i genrate a 3x3 int array each with random numbers. I have preset "win condition" matrices spelled out such as:

    1 0 0
    0 1 0
    0 0 1

    Here would be a win matrix for a diagonal win. How would you go about comparing a matrix such as

    7 5 3
    2 7 2
    1 9 7

    to the win matrix to check for a win?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    The problem here is that comparing the matrix given to the "win" matrix doesn't reveal any numbers in common, so why you think that's the right thing to do escapes me.

    If this is traditional slots in that you'll have only one "1" per column, then you actually want to store just which row is the "1" in. So the slot you have would have win[0]=0, win[1]=1, and win[2] = 2; then you can check that slots[0][win[0]]==slots[1][win[1]] and that slots[0][win[0]]==slots[2][win[2]]. And if you have a bunch of different patters, you might have a larger win array (so maybe win[0][0]=win[0][1]=win[0][2] = 1, for the center row).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C - access violation
    By uber in forum C Programming
    Replies: 2
    Last Post: 07-08-2009, 01:30 PM
  2. Matrix Help
    By HelpmeMark in forum C++ Programming
    Replies: 27
    Last Post: 03-06-2008, 05:57 PM
  3. What is a matrix's purpose in OpenGL
    By jimboob in forum Game Programming
    Replies: 5
    Last Post: 11-14-2004, 12:19 AM
  4. Matrix and vector operations on computers
    By DavidP in forum A Brief History of
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM