ERROR:TypeError: No matching declaration found after argument-dependent lookup.require (positionIsInBounds(xpos,ypos)); ^-----^

pragma solidity ^0.5.1;

contract TicTacToe { 
//addresses of the players who are competing.
    address player1;
    address player2;
    uint8 current_move =0;

    enum SquareState {empty, x, o}
    SquareState[3][3] board;

    constructor(address _player2) public {
        player1 = msg.sender;
        player2 = _player2;
    function stateToString() public view returns (string memory){
         return string(abi.encodePacked("\n",

    //string representation of a board row
    function rowToString(uint8 ypos) public view returns(string memory){
        return string(abi.encodePacked(squareToString(0,ypos), "|",squareToString(1, ypos), "|",squareToString(2, ypos)));

    //string representation of a square on the board
    function squareToString(uint8 xpos, uint8 ypos) public view returns (string memory) {

        require (positionIsInBounds(xpos,ypos));
        if(board[xpos][ypos] == SquareState.empty){
            return " ";
        if(board[xpos][ypos] == SquareState.x){
            return "x";
        if(board[xpos][ypos] == SquareState.o){
            return "o";

    function positionIsInBounds(uint8 xpos, uint8 ypos) public pure returns(uint8,uint8) {
        return (xpos>=0 && xpos<3 && ypos>=0 && ypos<3);


A require statement takes a Boolean value (true or false) as input.

Your positionIsInBounds function is declared to return a tuple (uint8,uint8).

Note that inside this function, you are indeed returning a Boolean value.

However, due to the function declaration, your require statement fails to compile.

Your positionIsInBounds function would have also failed to compile, if the compiler had reached that point in your code.

Looks to me like you've mistakenly declared this function's output types identical to its input types (uint8,uint8); just change it to bool and you're done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.