Page 1 of 1

user input on 3x3 tic tac toe board?

Posted: Sun Feb 09, 2020 10:34 pm
by bluebirdaerie
Hi, I'm quite new to programming with Ren'py but am working on a to-do 'game' where the user inputs what they want to do on each square of a tic tac toe grid. Once entered, the game will randomly select what the user should do next.

I know the baseline of what I need is all in just having the player input data that the game will save, and I've been able to do the basic - "Name your character"! Code,

But I'm not sure how to approach this big chunk.

I think the easier method would be to allow the user to input their tasks in the text box, separately for each one. Each line becomes its own variable which will be randomly placed on the tic tac toe board.

That's where I'm kinda stuck, I'm not sure how to show this on the screen, on a board. I know it's gotta do with making a frame but that's about it. If anyone can steer me towards similar codes or even offer a mockup I could work with, I'd appreciate it!

Re: user input on 3x3 tic tac toe board?

Posted: Mon Feb 10, 2020 1:22 pm
by Per K Grok
bluebirdaerie wrote: Sun Feb 09, 2020 10:34 pm Hi, I'm quite new to programming with Ren'py but am working on a to-do 'game' where the user inputs what they want to do on each square of a tic tac toe grid. Once entered, the game will randomly select what the user should do next.

I know the baseline of what I need is all in just having the player input data that the game will save, and I've been able to do the basic - "Name your character"! Code,

But I'm not sure how to approach this big chunk.

I think the easier method would be to allow the user to input their tasks in the text box, separately for each one. Each line becomes its own variable which will be randomly placed on the tic tac toe board.

That's where I'm kinda stuck, I'm not sure how to show this on the screen, on a board. I know it's gotta do with making a frame but that's about it. If anyone can steer me towards similar codes or even offer a mockup I could work with, I'd appreciate it!
I think you need to explain what it is you want to do a bit more clearly.

What I'm getting is that the player can make text inputs that are randomly placed on a board that is divided in 3x3 squares. As I understand it Tic, tac, toe has nothing to do with this, except for the shape of the board.

If that is correctly understood it might help if you explained a bit further what the purpose of this is.

If it is not correctly understood it might help if you explain what it is actually meant.

Re: user input on 3x3 tic tac toe board?

Posted: Tue Feb 11, 2020 11:07 pm
by bluebirdaerie
Basically, I want for the player to make 9 different text inputs before being presented with a screen that has randomly assigned those variables to spaces on the board.

When the player completes the variable in the game, the area where said variable was located will be crossed out.

So as an example:

I'm making a board for building habits.
As an artist, I want to spend time drawing more.
I input my projects + time I want to spend on it.

Draw 1 Minute
Draw 2 Minutes
Draw 3 Minutes
Draw 4 Minutes
Draw 5 Minutes
Draw 6 Minutes
Draw 7 Minutes
Draw 8 Minutes
Draw 9 Minutes

These inputs become variables that are then randomly placed on a 3x3 square and each will be crossed out when I've completed 'said task for that amount of time.

That's pretty much the gist of it, I just don't know where to get started on how to properly code what I envision.

Re: user input on 3x3 tic tac toe board?

Posted: Wed Feb 12, 2020 1:21 pm
by Per K Grok
bluebirdaerie wrote: Tue Feb 11, 2020 11:07 pm Basically, I want for the player to make 9 different text inputs before being presented with a screen that has randomly assigned those variables to spaces on the board.

-----
OK, I'm still unsure where you are going with this, but I can give you something to start with. The code below will let you enter 9 tasks and then displace those tasks in a random order on a 3x3 board.

Code: Select all


default v0="0"
default x=0
default numb=1

default list1=["v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9"]
default list2=[]


screen tictac():

     grid 3 3:
         text list2[0]
         text list2[1]
         text list2[2]

         text list2[3]
         text list2[4]
         text list2[5]

         text list2[6]
         text list2[7]
         text list2[8]



label start:

    $ v0= renpy.input("Enter task [numb]")    ## enter tasks
    $ list1[numb-1]=v0
    $numb+=1
    if numb<10:
        jump start

label tic:

    while x<9:                                                               ##make the order random
        $ numb= renpy.random.randint(0, len(list1)-1)  
        $ v0= list1.pop(numb)
        $ list2.append(v0)
        $ x +=1

    show screen tictac

    pause



Where you want to go with this I still don't get.

Re: user input on 3x3 tic tac toe board?

Posted: Sat Feb 15, 2020 2:51 pm
by bluebirdaerie
Thank you, this is a good start :)