logo
down
shadow

Problems on making a Tic Tac Toe Game in Java


Problems on making a Tic Tac Toe Game in Java

Content Index :

Problems on making a Tic Tac Toe Game in Java
Tag : java , By : arbeitandy
Date : November 24 2020, 09:00 AM

wish of those help Your IniBoard is wiping out the players moves. Separate your initialization and your printing into two separate methods:
public static void IniBoard(String[][] TicTable)
{
    for(String[] TicTable1 : TicTable)
    {
        for(int c = 0; c < TicTable[0].length; c++)
        {
            TicTable1[c] = "-";
        }
    }
}

public static void PrintBoard(String[][] TicTable)
{
    for(String[] TicTable1 : TicTable)
    {
        for(int c = 0; c < TicTable[0].length; c++)
        {
            System.out.print(TicTable1[c]);
        }
        System.out.println("");
    }
}
public static String GetWinner(String[][] TicTable)
{
    //your code here:
    return null;
}

public static void main(String[] args)
{
    String Gp1 = "", Gp2 = "";
    String[][] TicTable = new String[3][3];
    String Player1 = "X", Player2 = "O";
    String winner = null;
    int row1 = 0, row2 = 0;
    int col1 = 0, col2 = 0;

    IniBoard(TicTable);
    while(winner == null)
    {
        PrintBoard(TicTable);
        Player1(Player1, row1, col1, TicTable);
        Player2(Player2, row2, col2, TicTable);
        winner = GetWinner(TicTable);
    }
}

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Problems with threads, making a game in Java


Tag : java , By : qba73
Date : March 29 2020, 07:55 AM
it fixes the issue I'm doing a Snake game in Java. I have the basic functionability, but I want pause the game when I click on a button. But the problem I have is when I clic on this button, the game is paused, but when I click again the game doesn't recognize the controls. I have a method called Init, on this I initialize the thread "Hilo". I tried to make a second thread in which I put an actionPerformed for the button, but the problem continued, now I am more confused. Here is my code:
if(state.equals("paused")) 
{
    actual.wait();
}

Problems with making "Catch the falling hair" game


Tag : javascript , By : Longchao Dong
Date : March 29 2020, 07:55 AM
To fix the issue you can do I made the setTimeout reference the function instead of calling it immediately (putting the parens calls it and references the return value, putting just the function name references). Then I tweaked the transition to animate the top over 3 seconds while the left takes just 1 second. Then I made makeDestination call itself after a delay. Lastly, the "hair" needs to jump back up to the top, so I change the transition to be immediate, change the CSS, then change the transition back to animate.
https://jsfiddle.net/9pq6xfxc/1/

Problems with switching players and keeping track of each of their score when making a Cricket game


Tag : python , By : chawei
Date : December 26 2020, 01:01 AM
I think the issue was by ths following , I don't know Cricket's rules but in class Player I would keep player's name and his score. It could have also function run() which adds random value to his score (or create method with parameter - value which you want to add to score)
class Player():

    def __init__(self, name):
        self.name = name
        self.score = 0

    def run(self):
        self.score += random.randint(0, 6)

    def __str__(self):
        return "{} (score: {})".format(self.name, self.score)
class Team():

    def __init__(self, players):
        self.players = players
        self.current_batsman = 0
        self.current_run = 0

    def set_next_batsman(self):
        self.current_batsman += 1
        if self.current_batsman >= len(self.players):
            self.current_batsman = 0

    def get_current_batsman(self):
        return self.players[self.current_batsman]

    def run(self):
        self.players[self.current_batsman].run()

        if self.current_run % 2 != 0:
            self.set_next_batsman()

        self.current_run += 1

    def __str__(self):
        return "Player: " + ", ".join(str(p) for p in self.players)

    def total_score(self):
        return sum(p.score for p in self.players)
team1 = Team( [Player("a"), Player("b"), Player("c")] )
team2 = Team( [Player("x"), Player("y"), Player("z")] )

print('Team1:', team1)
print('Team2:', team2)

for number in range(1, 5):
    print('Round:', number)
    print('Team1 current batsman:', team1.get_current_batsman())
    team1.run()
    print('Team2 current batsman:', team2.get_current_batsman())
    team2.run()

print('Team1:', team1)
print('Team2:', team2)

print('Team1 total score:', team1.total_score())
print('Team2 total score:', team2.total_score())

I'm making a game in Java and whenever I try to bring up my in game menu the program minimizes?


Tag : development , By : user92243
Date : March 29 2020, 07:55 AM

Problems Making Text Based RPG game/template in C++


Tag : cpp , By : user122937
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • How to detect if gson.fromjson() has excess elements
  • I cant generate the proper code to select the a specific filter on a BI dashboard I am working on
  • How to Inject Dependencies into a Servlet Filter with Spring Boot Filter Registration Bean?
  • Thrift types as a Generic
  • Effective algorithm to random 4 unique integers less than a big max such as 100_000
  • Combining or and negation in Java regex?
  • Unable to instantiate default tuplizer Exception
  • Multi-tenant migration to work with quarkus
  • Ignite persisting a Set: Cannot find metadata for object with compact footer
  • Maven cannot resolve Jacob dependency using eclipse
  • testcontainers oracle database container starts before database user is created
  • Launching two spring boot apps in integration test
  • Is there a way to add a HashMap's value that is a integer array into a ArrayList?
  • Is there any way that I can get a parameter in paintComponent?
  • Empty stack with one recursive method and one iterative method
  • What's the behavior of onBackpressureBuffer in RxJava2
  • Java regex can only use 1 quantifier in a lookback (need 2)
  • How to fix error in native query : it is showing syntax error near or at
  • How to retrieve nested object from a document and display it in FirestoreRecyclerOptions?
  • Why not use ListIterator for full LinkedList Operation?
  • Android Webview EvaluateJavascript sometimes does not return a response
  • Matcher java doesn't work but regex seems to be good
  • Finding dimensions of a .gif file
  • Java Number format how to change +/- sign to custom text
  • Entity partially saved when using JOINED inheritance strategy and setting spring.jpa.properties.hibernate.jdbc.batch_siz
  • Stored Procedure in Java Spring Boot Project returns null as Output
  • How to solve org.hibernate.MappingException which is causing due to inheriting a class
  • Clean Archtecture. Understanding of scheme
  • Processing 3 triangle not showing in Javafx 8 Window tab
  • How to specify a sequence-based generated value in Hibernate 5 via legacy mapping
  • Spring-boot application not getting auto-deployed on startup
  • How to only pass strings that the user select
  • Is there a way to SELECT using "GREATEST(field1, field2)" where field1 and field2 are aggregate sums in the sa
  • How to handle JSON objects wrapped into one JSON object with retrofit2?
  • Configure Hazelcast CPSubsystem Retries Timeout
  • how to use onBindViewHolder with multiple items in android RecyclerView
  • No ParameterResolver registered for parameter in BeforeAll method
  • Finding the path in a graph with the least casualties according to the lanchester square law
  • MongoWriteException when inserting into Mongodb with composite custom _id
  • Fetch Oracle procedure metadata with Java when multiple procedure signatures
  • Value modification of key-pair in HashMap and impact for a HashCode
  • Migration from solrj to spring-data-solr
  • How to check if you're still connected to the database with jpa
  • Use Date type in the graphql scheme
  • Split and add the string based on length
  • Is "main" method of spring boot application required when deploy as war
  • Getting the average within specific numbers in an array
  • how to use izpack to make my jar application to installer?
  • What is meant by src in Java Eclipse?
  • Create a mirrored linked list in Java
  • Examples of good JPA Java Desktop Application
  • Translate Java to Python -- signing strings with PEM certificate files
  • Algorithm Analysis tool for java
  • Java serial comm API - what does inputstream.read() return if a timeout occurs?
  • How do I make a background thread in Java that allows the main application to exit completely? This works in Linux, but
  • How to add an image dynamically at runtime in java
  • Java App on Mac asking for allow network connections everytime
  • Best actively maintained Java XMPP Library?
  • Multi-Threaded Application - Help with some pseudo code!
  • Scoping a StringBuilder inside a for loop
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com