Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Katye Russell
    @complikatyed
    Since I was at the computer still, I went ahead and made this (didn't realize before that I could).
    Katye Russell
    @complikatyed

    I've been thinking about what you said, @AndyMeagher, about setting the board (placing your own ships) and then playing. What if we adapt what you two have already written so that the "findCoords" function becomes "setBoard" and then, once your board is set, you get matched with another player by choosing a game the way Ed and James had their tic-tac-toe set up?

    I added an image append to the function to show where you've placed a submarine, and I'll work some tonight and tomorrow with trying to get the move data appending to the same 'board' -- via uuid or something.

    Andy Meagher
    @AndyMeagher
    hey if you all want to look at my branch I made some functions that let you append only 3 ships to the board and then the location of those are updated in the board variable and that is now push to firebase
    Katye Russell
    @complikatyed
    Nice!
    Katye Russell
    @complikatyed
    When I run your code, I'm getting a message in the console that "update" is deprecated. FB wants us to use "set" instead, so I tried changing it and got no message (and it still works).
    Katye Russell
    @complikatyed
    Ayumi and I are working at the Panera in Green Hills this morning. If either of you want to get together you can come join us, or I can roll to wherever you want to meet. Just let me know.
    Margaret Clinard
    @margaretclinard
    Any progress? I was trying to make a function that would add a fire icon on top of a ship only if a ship was already in a cell....no such luck...
    function displayFire(data) {
      $('td').one('click', function (event) {
        _.forEach(data, function(populatedBoardArray, key){
          console.log(populatedBoardArray);
          console.log(key);
          if (populatedBoardArray[0] === '<img src="http://www.clipartlord.com/wp-content/up…3/03/submarine.png" height="100px" width="100px">') {
            attachFire($(this));
          }
        });
      })
    }
    Katye Russell
    @complikatyed
    I've reworked a bunch of stuff and am feeling REALLY successful. It may not be what we ultimately decide to use, but I've learned A TON OF STUFF just this morning. I'm about to push to my branch, and then you can take a look.
    Margaret Clinard
    @margaretclinard
    oh goodie!
    did you learn by doing or did you find a good source?
    Katye Russell
    @complikatyed
    Ayumi pointed me to the Firebase blog, and that's helped enormously, but mostly I've been experimenting with strategies (and pulling apart Andy's code and rebuilding it in new ways).
    Katye Russell
    @complikatyed

    Here's the big stuff I changed (and again, we don't have to use my code, I was just trying to figure out what the heck was going on with the app):

    1. New createGame() function to push games into the FB.
    2. Game data structure now includes gameboards for two players, ship count for each player, and point count for each player.
      1. I FINALLY figured out how to capture the stupid uuid for an individual game, so we can push ship data, as well as hit/miss data and points earned/ships destroyed to the correct game.
      2. I've separated out appending and data pushing, with the goal (which I'm working on next) of having the ship info (and eventually the hit/miss data) come from FB in order to display in the users' 'boards'.
        I think there's some other stuff, too, but I can't remember it right now.

    You've both got access to my xogame firebase if you want to look at the data structure as I've adapted it, and my latest branch push included my most up to date work.

    Those indents are annoyingly incorrect.
    Andy Meagher
    @AndyMeagher
    hey just got home from work and am pretty exhausted, not sure how much I'll work on,. I haven't looked at your code yet, but how are you pushing the board to firebase? are you just pushing it up as the array? I thiiiink i figured out how to push it up as an object which may be helpful. I figured since we are all still learning, we can just come together tomorrow to compare codes and pick and chose which approached work best?
    Katye Russell
    @complikatyed

    I switched from five arrays of five to one array of 25 and used Allison's strategy of starting out with the arrays full of "b" (I assume for "blank"). The advantage of one big array is that the index is much easier to find. I also added an id to each td that matches the index of the array (though now that I'm thinking about it, I did it with numbers, which may not have been smart...).

    I pushed the array like this: function updateP1Board(uuid, index, ship) { fb2.child(uuid).child('p1Board').child(index).set(ship); }

    _
    Here's the code for creating a new game and grabbing its uuid: function createNewGame() { var fb2 = new Firebase('https://xogame.firebaseio.com/Games'); var newGameRef = fb2.push(); var uuid = newGameRef.key(); newGameRef.set({p1Board: emptyBoard2, p2Board: emptyBoard2, p1Ships: '', p2Ships: '', p1Points: 0, p2Points: 0}) return uuid; }
    _
    Now that I know how to do it, I'm pissed that it's actually stupidly easy -- but boy did it take a ridiculous amount of time to figure out!
    Andy Meagher
    @AndyMeagher
    coool, so having 1 array of 25 doesn't mess up creating the table?
    Katye Russell
    @complikatyed

    Nope, unless I'm missing something really important. I changed the image appending approach and don't have that fully re-integrated yet, so if Scott wants us to present in the morning we may be better off with what you've got.

    I've tried to frame out all the functions we still need to write -- most require checking elements from firebase, but I think we can knock them out together pretty easily tomorrow. (I hope so anyway).

    I'm going to wrap up for tonight in a few minutes (mainly because Panera is going to boot me out pretty soon). See you both in the morning!

    Andy Meagher
    @AndyMeagher
    k goodnight! looking at yr stuff now-- it looks awesome!
    Katye Russell
    @complikatyed
    You haven't seen the REALLY awesome stuff yet, but thanks. I'm feeling pretty proud of the learning progress I made today. I feel like it was sort of jumping from 5th grade to HS senior in one day.
    Andy Meagher
    @AndyMeagher
    ohh! real quick if youre stil there
    did you by chance take any of the code about going through each game and checking if there are 2 players?
    Katye Russell
    @complikatyed
    Take it how?
    I'm not entirely sure what you're asking, but I think the answer is no.
    Andy Meagher
    @AndyMeagher
    incorporate it i guess
    or does your code do that yet?
    Katye Russell
    @complikatyed
    _
    No, not yet. Was yours working for that?
    Andy Meagher
    @AndyMeagher
    I can try to see if I can put that into the newGame function you wrote
    yes but I stole it from scott
    Katye Russell
    @complikatyed
    No worries, that's what Scott is for.
    My plan for that function was to have the game check for an "empty" board (i.e., with no ships in it yet), but if you've got something ready to roll, let's use it!