#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    Need Serious Help


    Hey everyone im new here and I need help programming in python a game kind of like reversi but with a twist the board is randomly black and white each time the game is started and the orientation of the board should work but you have to click the squares to turn the black to white the goal is to turn the whole board white and does anyone know what i mean if not I can explain in further detail? Thank you everyone
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,931
    Rep Power
    481
    Othello play works by placing tiles onto the board. Game ends when no one can move, often because the board filled. All chips are down.

    What you describe with the board pre-colored seems to have a different rule set. Player "white" can toggle which squares? Please draw a configuration that makes sense? I haven't conceived of a good game played this way.

    And in your program does the computer play using an AI system? Does the computer merely provide a convenient board and enforce rules?
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    237
    Rep Power
    29
    if not I can explain in further detail
    You definitely should compose yourself, gather your thoughts into one heap and try your best to explain. In several well-formed sentences instead of one stream of words.

    I think you are speaking of the game for one player who makes moves to change colors of some cells. I think I've heard of two games - in one there are special rules or patterns on which cells are flipped when you click any given cell. The other is the reversi for one player where the goal is to make the least number of moves (not very funny). And why have you mentioned orientation of the board?
    CodeAbbey - programming problems for novice coders
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    better explained


    (its called logic) Logic Consists of a rectangular game board consisting of square tiles which can be either black or white.
    At the start of the game, the color is random
    When the user clicks on a tile, that tile and the tile above and below it and the tiles to the left and the right of it switch
    Black -> white and white -> black
    You win the game when all the tiles are white
    so there is only one player
    The initial pattern MUST be one that actually has a solution
    You canít just randomly set the tiles black/white and expect this
    HINT: Shuffle in card game
    You must use graphics.py for output
    CANNOT BE ANY TEXT OUTPUT
    getMouse is required
    CANNOT BE ANY KEYBOARD ENTRY
    Count the number of clicks required to clear the board and display it
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    picture of board


    www. dadsgaming addiction.com / othello /
    the board will basically look like that from the start and the squares will be black and white instead of circles and your goal is to make the whole board white
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    237
    Rep Power
    29
    Well, it looks my second guess was correct. The idea of the game is clear now, but I think here is some problem.

    It looks like your homework, and it sounds like you expect someone will do it instead of you. I fear this is hopeless approach. People at this forum do not like "code-beggars" and usually do not help in such cases.

    However, if you start writing the code yourself and at some point you will need a help or hint about some specific problem - you always are welcome to ask and answer is almost guaranteed.
    CodeAbbey - programming problems for novice coders
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0
    well i have code that i wrote for othello but at this point i dont know how to implement the graphics nor the random board configurations or the 1 player thing like i get othello i just dont know how to change it into this
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0
    Originally Posted by rodiongork
    Well, it looks my second guess was correct. The idea of the game is clear now, but I think here is some problem.

    It looks like your homework, and it sounds like you expect someone will do it instead of you. I fear this is hopeless approach. People at this forum do not like "code-beggars" and usually do not help in such cases.

    However, if you start writing the code yourself and at some point you will need a help or hint about some specific problem - you always are welcome to ask and answer is almost guaranteed.
    also i know i may have to rewrite my code if so how do i even go about it then
  16. #9
  17. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,931
    Rep Power
    481
    Write the game with a simple representation,
    write the graphical part secondly.

    Incorporate a user configurable color palette. Have the colors fade toward as appropriate white or black as time progresses.

    Hey! This is cool:
    Code:
    >>> False
    False
    >>> 
    >>> not False
    True
    >>> 
    >>> True
    True
    >>> 
    >>> not True
    False
    >>> 
    >>> not not True
    True
    >>> 
    >>> not not not True
    False
    >>> 
    >>> not not not not True
    True
    Without the graphics, here's an implementation of the game written in J (www.jsoftware.com)
    Code:
    show =: empty (1 ,: _2 + $) smoutput;.0 ] NB. show BOARD
    initialize =: 8 8&$: : (dyad define)
     BOARD =. 0$~2+x
     MASK =. ($BOARD){.1(<1 1)}3 3 $ 0 1    NB. excusive or mask
     flip =: (~: |.&MASK@:-.)~             NB. BOARD =: flip BOARD
     for_I. i. y do.
      BOARD =. (>:?x) flip BOARD
     end.
    )
    And here is the use in an actual rudimentary and easy level game. The j interactive prompt is 3 spaces at the start of a line.
    Code:
       BOARD =: initialize 3                   NB. number of random flips
       show B =: BOARD
    0 0 0 0 1 1 1 0
    0 0 0 0 0 1 0 0
    0 0 0 0 0 0 0 0
    0 0 0 1 0 0 0 0
    0 0 1 1 1 0 0 0
    0 0 0 1 0 0 0 0
    0 0 0 0 0 0 0 1
    0 0 0 0 0 0 1 1
       show B =: 1 6 flip B
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 1 0 0 0 0
    0 0 1 1 1 0 0 0
    0 0 0 1 0 0 0 0
    0 0 0 0 0 0 0 1
    0 0 0 0 0 0 1 1
       show B =: 5 4 flip B
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 1
    0 0 0 0 0 0 1 1
       show B =: 8 8 flip B
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0
    Last edited by b49P23TIvg; November 21st, 2013 at 01:46 PM. Reason: generalize show to arbitrary rows and columns. We'll leave the rank at 2,. Rank is also easy to change.
    [code]Code tags[/code] are essential for python code and Makefiles!
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0
    perfect that gave me the best idea for my code perfect thank you i just didnt know what and how to figure the different permutations of how the board will win now i no!
  20. #11
  21. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,931
    Rep Power
    481
    I'm glad you're all set.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo