1. If you're looking for help-related things (for example, the key rebinding tutorial), please check the FAQ and Q&A forum! A lot of the stickies from this forum have been moved there to clean up space.
    Dismiss Notice

Wiring: Tic-tac-toe game, and a question for the devs

Discussion in 'Starbound Discussion' started by Sectrix, Mar 1, 2014.

  1. Sectrix

    Sectrix Phantasmal Quasar

    Wired up a tic-tac-toe game using basic logic gates - no mods. I can provide schematics if anyone wants to try for themselves.

    Sadly, the wiring bug makes this project just a curiosity for now.

    For my next project, I want to wire up a Battleship implementation. In the video, you can see that tic-tac-toe uses 15 cells for the various circuit stages, plus the playfield. Battleship will require over 600 cells. My question to the devs is, once the bugs are worked out, can the wiring engine even handle something of that scale?

    Edit: Upon further experimentation, and I don't know how I missed it, implementing memory can be greatly simplified. Still, my question stands: how complicated can I get?
     
    Last edited: Mar 1, 2014
  2. That is quite an impressive achievement.
     
  3. Gunslinger

    Gunslinger Existential Complex

    Cool beans! All hail Sectrix!
     
  4. Grimmturd

    Grimmturd Cosmic Narwhal

    I was waiting for a post like this. So I could link this:

    Best when played alongside this:
     
  5. Sectrix

    Sectrix Phantasmal Quasar

    0_0

    Challenge accepted.
     
    nababoo likes this.
  6. Sectrix

    Sectrix Phantasmal Quasar

    Build instructions for tic-tac-toe.


    BE ADVISED: There is currently a bug in Starbound that deletes some wiring when a planet is unloaded. Until the bug is fixed, this project will almost certainly break when you leave the area. However, for the adventurous, there is a workaround.

    What it does


    A classic game of tic-tac-toe. Players take turns marking Xs and Os on the play-field. The first player to have three in a row horizontally, vertically, or diagonally, wins.

    What you need

    • 15 NOT Gates

    • 69 AND Gates

    • 41 OR Gates

    • 22 Latches

    • 84 Bulbs

    • 10 Buttons

    • 2 Alarms

    How to build it

    Tic-tac-toe can be divided into six sections. These sections are:

    • Play field

    • Player control

    • Play switch

    • Win detector

    • Win lock

    • Draw detector
    To make building easier, we'll wire up one section at a time and test them as we go. Let's jump right in with the fun part – the play field!

    Play field


    [​IMG]


    The winner alarms, draw and turn lights, and all the buttons are fairly self-explanatory, and we'll be wiring those in later. For now we'll wire up the player lights. For clarity, I've only wired one X and one O in the picture.

    There are nine OR gates for each player (labeled 'P1 lights' and 'P2 lights') that represent the squares that player has played – one gate for each square in the play field. The output of each of these OR gates should be wired to the bulbs in it's corresponding square to form an X or an O for player one and player two. You can test when you're done by wiring a button to one of the inputs of the OR.

    Player control


    [​IMG]


    You'll only need one of these circuits. We'll be wiring in 'P1 turn' and 'P2 turn' later. The two wires labeled 'To all 9 buttons' go to each one of the nine buttons on the play field. That's two wires per button. To reduce clutter, you could connect these two wires to the output of an OR gate instead, then connect either one of the inputs of the OR gate to each button on the play field.

    Only one of the two latches should be on at a time. You can test this circuit by pushing one of the buttons on the play field. The latches should switch. Push it again, and they should switch back.

    Play switch


    [​IMG]


    You will need nine of these circuits – one for each square on the play field.

    • 'To square's button' goes to the button on the play field for the square this circuit is for.

    • 'To P1 turn' connects to 'P1 turn' on the player control circuit.

    • 'To P2 turn' connects to 'P2 turn' on the player control circuit.

    • 'To reset' wires (both of them) go to the reset button.

    • 'To P1 light and win detector' has multiple connections. One connection is to the OR gate on the play field for this square (labeled 'P1 lights' on the play field). The other connections we'll be making later.

    • 'To P2 light and win detector' has multiple connections. One connection is to the OR gate on the play field for this square (labeled 'P2 lights' on the play field). The other connections we'll be making later.

    • 'To draw detector' will be connected later.

    To test these circuits, push the reset button first. Neither of the two latches should be on. When you push the button for this square, one of the two latches should turn on. Push reset again, then the button for the square, and now the other latch should turn on. Pushing the button again without resetting should have no affect.

    Win detector


    [​IMG]


    You will need two of these circuits – one for each player. Each square in the play field has been given a letter, A through I. The connections labeled with letters go the play switch circuit for the corresponding square in the play field. These are the ' To P1 light and win detector' and 'To P2 light and win detector' connections on the play switch circuit. For example, the 'A' connections for the player 1 win detector are wired to 'To P1 light and win detector' on the switch circuit for square A. The 'A' connections for the player 2 win detector are wired to 'To P2 light and win detector' on the switch circuit for square A, and so on. The 'To Px Wins' will be wired after the next circuit.

    To test this circuit, push reset and just play some games! You'll have to test all eight possible win combinations for each player.


    Win lock


    [​IMG]


    You only need one of these circuits. The four wires grouped on the left all go to the reset button. 'P1 wins' and 'P2 wins' are connected to the 'To Px Wins' output for each of the player win detectors. 'To P1 win light' and 'To P2 win light' are connected to the winner lights on the play field.

    To test this circuit, reset the game and allow a player to win. Continue playing the game and allow the other player to win. Only one winner light should come on.

    Draw detector


    [​IMG]


    You only need one of these circuits. Just like the win detector, the connections are labeled with the letter of the square it should go to. In this case, the connection will be to the 'To draw detector' on the play switch circuit. Finally, 'To draw light' connects to the draw light on the play field.

    To test this circuit, simply play all squares on the field to a draw.


    The very last connections to make are to wire the 'To P1 turn' and 'To P2 turn' lights on the play field to the 'P1 turn' and 'P2 turn' connections on the Player control circuit.


    At this point your game is finished!

    \o/


    Notes

    If you wish to follow the schematics shown here, make note of this connection key:

    [​IMG]

    Also, this circuit was adapted for Starbound from the real-life circuit described here.
     
    Last edited: Mar 20, 2014
  7. FuzzyThor

    FuzzyThor Existential Complex

    Cool beans. I was able to make this. Here is a video I uploaded to youtube.

    I credited you in the description.
    I am going to have a warp point on my server for people to play this game.
    I am going to make another TTT set.
     
    The | Suit and Sectrix like this.
  8. FuzzyThor

    FuzzyThor Existential Complex

    @Sectrix For some reason when ever my planet unloads it does not save all of the connected wires. I always have to reconnect at leats 40 wires
     
  9. Sectrix

    Sectrix Phantasmal Quasar

    Yes, unfortunately this is currently a bug in Starbound. The issue involves chunks of the planet not loading at the same time. When there are wires that cross into a chunk that doesn't load right away, those wires are deleted. There is a workaround using optical sensors and doors to get signals across boundaries, however.

    I'm sorry I thought this was a well known thing; I'll put a warning on the instructions.

    In any case, excellent work! I'm glad the instructions were useful to you.
     

Share This Page