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
    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!
    Andy Meagher
    @AndyMeagher
    hmmm...yeah its gonna be tricky I guess. The way that he does it is in the same place where he makes the newGame uuid, I'll see if I can make it make sense
    Katye Russell
    @complikatyed
    I just pushed my most recent work up to my branch. It's got the framed out functions for the rest of the game -- they're not written as functions yet, but I went through with comments and tried to include all the steps (and subfunctions) we'd probably need in order to make it all work.
    Andy Meagher
    @AndyMeagher
    awesome
    Katye Russell
    @complikatyed
    Again, we don't need to use what I wrote, I was just trying to figure it out for myself, since I've been feeling really perplexed and overwhelmed.
    Andy Meagher
    @AndyMeagher
    yeah, that's the point of all this in the end
    Katye Russell
    @complikatyed
    Feeling better about it all today, lol.
    Andy Meagher
    @AndyMeagher
    I feel the same way about my code, I'm not attached to it
    Katye Russell
    @complikatyed
    A BUNCH of my code is just rearranged versions of yours anyway. I was struggling to understand, so I decided to try breaking up your functions to see whether I could understand them well enough to put them back together again in a new way.
    Okay, I'm heading home to eat dinner and fall in bed. See you both in the morning!
    Andy Meagher
    @AndyMeagher
    hows it goin?
    Margaret Clinard
    @margaretclinard
    we just entered a game together as p1 and p2 on different computers!
    updated code is on katye's branch
    Andy Meagher
    @AndyMeagher
    awesome!
    did you have to deploy the firebase to test that?
    Margaret Clinard
    @margaretclinard
    nope, just used local host
    Andy Meagher
    @AndyMeagher
    how did you end up creating the table? i think i figured out how to get mine communicating with firebase better
    Margaret Clinard
    @margaretclinard
    we are working off of the hard coded table, but we haven't gotten to appending actual images when you place your ship, currently the game info is just going up to firebase when you click join game / place your ships
    how is yours working?
    Andy Meagher
    @AndyMeagher
    pretty good, wanna screen share for a sec?
    Margaret Clinard
    @margaretclinard
    ok
    Andy Meagher
    @AndyMeagher
    whats yr email
    Margaret Clinard
    @margaretclinard
    Andy Meagher
    @AndyMeagher
    wtf
    Andy Meagher
    @AndyMeagher
    I think i fixed some bugs and pushed it to my branch...before it was giving you that alert to wait, whenever you were player1 now it is giving you that alert to wait for a player only if there is no firebase data for board2..so player1 will get that alert if there is no player2 but can wait and click again and play when there is
    also i added a shots variable, so you only get 5 shots on the board. each time you click a TD, its subtracting from the shots. if you miss 5 times, it's gameover cuz you ran out of ammo
    Katye Russell
    @complikatyed
    I like the running out of ammo feature. That's cool!
    After some bumps in the road, we got the ship data to post to firebase, and were able to have both of us posting to the same firebase game from our respective computers.
    Katye Russell
    @complikatyed
    I don't have a playable app yet (so I'm glad yours is working so well, Andy!). I have made some crazy progress, but trying to explain it here will probably make all three of our heads explode. I've pushed it to my branch if you want to look at it, but you're not obliged. See you in the morning!