Thread: Othello help

  1. #1
    Registered User
    Join Date
    Mar 2018
    Posts
    2

    Exclamation Othello help

    Hello I'm new to programming and I am working on an Othello game and I have issues creating the function to determine whether a entered move is valid or not. Can someone please help its urgent.
    I have attached an incomplete code of what I have so far. Can someone please help?main.c

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,079
    Why is your board 26x26 when the actual game board is 8x8 ?

    You seem to be doing hacky things with the values of characters.
    typeOfPlayer='W'-(21*i);

    I've no idea what you're trying to do here.

    checkLegalInDirection and checkLegality are a good start, but could probably do with some more splitting to reduce internal complexity.

    > int row,col,temp;
    > printf("Enter a move:\n");
    > scanf(" %c%c%c",&typeOfPlayer,&row,&col);
    Watch those scanf formats.
    Use a compiler like gcc with the -Wall option to diagnose these before you run the code and wonder WTF is happening.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Othello help
    By usama123 in forum Game Programming
    Replies: 0
    Last Post: 03-06-2018, 08:10 PM
  2. Othello program
    By cbriceno82 in forum C Programming
    Replies: 15
    Last Post: 12-15-2011, 08:56 AM
  3. Othello procedure
    By Morrow in forum Game Programming
    Replies: 7
    Last Post: 10-05-2004, 05:29 AM
  4. othello AI
    By laasunde in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 11-02-2003, 02:37 PM
  5. Othello question
    By toaster in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 07-17-2002, 08:18 PM

Tags for this Thread