« first day (1420 days earlier)      last day (3515 days later) » 

7:01 PM
Boo!
 
the event is to setText on textfield
@Karl harro
 
I suppose the question was "where do you call payerTurn()?"
 
yep
@kiheru wb :D
well I called it just after firing the event
and after moves
but it didn't work
 
Boo back !
 
wb @itachi
 
7:08 PM
In what way it does not work? Does it not get called, or do not the listeners get called?
Add debugging output, if needs be
 
Ahh!
 
(you can simplify playerTurn() btw. Make the string a local variable, so that you need to write the loop only once)
 
The listener doesn't get called
 
If you add System.out.println("player turn") to playerTurn(), does that get printed?
 
nop
 
7:11 PM
@ItachiUchiha hiya
 
so you never call playerTurn()
 
@Uni still awake ?
 
in Tavern on the Meta on Meta Stack Exchange Chat, 45 mins ago, by Unihedron
sigh 978 "thanks so much!" comments left..
 
dont you have school tom
 
no its saturday.
 
7:13 PM
second
 
dont know what all do you chat on meta. All arabic to me.. :P
neways... so ssup @all ?
anyone has any idea on Map.Entry interface in Map ?
 
@kiheru I do call it
 
where? that code must then not be reached. otherwise the debugging output would get printed
 
here's an example
if ((targetX - highlightedX) == -1 && Math.abs(targetY - highlightedY) == 1) {
						doMove(targetX, targetY, highlightedX, highlightedY);
						playerCheck = 1;
						disableButtons(redPawn);
						disableButtons(redKing);
						playerTurn(2);
I call it down there
this fires up
private void playerTurn(int playerNumber){
		if(playerNumber == 1){
			for (GameEventListener listeners : listeners) {
		        listeners.playerTurn("White");
		    }
		}else if(playerNumber == 2){
			for (GameEventListener listeners : listeners) {
		        listeners.playerTurn("Red");
		    }
		}
	}
 
7:20 PM
whats wrong with the question?
 
Please don't dump code blocks. Use gist from github or pastebin or pastie.
 
and in my liveFeed Class
@Override
	public void playerTurn(String playerName) {
		textField.setText(playerName);

	}
sorry @Unihedron I count on you to remove them when we finish :P
 
I ran out of comment flags, am running out of post flags soon as well, so I'm not staying for too long.
 
i was eating potato chips with lots of red chilli powder in it
 
Unhealthy!
 
7:21 PM
and then my left eye felt itchy
so i rubbed my finger on it and now i am unable to open my left eye
 
LMAO
 
+ the burn
 
@Sabಠ_ಠ that looks like the implementation in of the interface part somewhere. The question is, where do you call the playerTurn() that fires the event (that's the reason to conventionally start those methods with fire. To make it obvious what they do)
 
@Unihedron Is it really that bad because he's posting a few lines of code? It's not even 12 lines in a block..
 
I call playerTurn everytime I finish a move or a jump
 
7:24 PM
@Karl Having them in separate lines is the problem, I have a userscript that condenses code blocks, not when they're in separate messages.
Plus, that's what gists are for.
 
so in the previous case after a jump I called the firePawn
after that I fired playerTurn
it's supposed to work
but it doesn't
 
Oh, I thought that smaller chunks of code were OK to post...
 
They are, but there were a several decent few chunks.
And I can't condense them.
 
@Karl its perfectly ok to post chunks of code
 
It's just not okay to post them one after the other
?
So chuck followed by 2 random chats chunk :3
 
7:27 PM
What we need to do is get Chuck to post chunks.
@Unihedron would be able to chuck Chuck's chunks.
 
That's gonna be Chucky Chunkies
 
now, if the debugging output in the playerTurn() that calls the GameEventListeners does not get printed, it means you're not calling that playerTurn
 
haha puny
bye for now, too tired
 
beat me to it @Karl --_
cya @uni
 
(which, in turn, means that the listeners do not get notified)
 
7:28 PM
@Sabಠ_ಠ IM me a chunk, we will take turns posting them, then it will appear as your posting them half as often!
 
I tried to print out the listeners and only the SidePanel works
 
@Karl right
 
@Karl I just wrote a userscript to deal with you
 
@Sabಠ_ಠ oh, so the playerTurn method in SidePanel does get called?
 
7:30 PM
nop
in sidepanel it's blank
lemme try it there
 
I'm in trouble! :(
 
You wrote: "I tried to print out the listeners and only the SidePanel works"
so something there works
 
I meant the Sidepanel fiePawnsOut
and yeah I just tested the playerTurn it works there
 
If you have other listeners, did you remember to add them using addGameEventListener()?
 
public void addGameEventListener(GameEventListener listener) {
	    listeners.add(listener);
	}
doesn't that do it?
it was in the BoardGrid
So I assumed it will work for both listeners?
 
7:34 PM
it works for any GameEventListener. but it needs to be called for all teh listeners you want to be notified
remember you needed to call it for the side panel
 
I implemented it
just like I did in sidepanel
crap I accidentally pasted my code to the public
 
there's no magic code. BoardGrid just maintains a list of GameEventListeners, and calls methods in those if needed. But to get to the list the listener must be added there. The way to do that is calling addGameEventListener()
 
check the pastebin
 
that looks fine. The issue is calling board.addGameEventListener()
you need to do that. just like you needed to do it for the side panel
 
I see
I forgot this part
	public GameBoard(){
		super();

		BoardGrid board = new BoardGrid();
		SidePanel pawnsOut = new SidePanel();
		LiveFeed liveFeed = new LiveFeed();
		board.addGameEventListener(pawnsOut);
		board.addGameEventListener(liveFeed);
 
7:40 PM
ok, that looks fine
 
so liveFeed will havr the listener
 
I'm sure it should work now :D
Oh boy that looks sexy :D
You're an inspiration @Kiheru :D
I simplified my method as well
private void playerTurn(String playerName){
		 for (GameEventListener listeners : listeners) {
			 listeners.playerTurn("White");
		 }
	}
 
that makes it always white's turn
very racist :-P
 
And I'm not even white xD
I actually edited it :P I pasted the wrong one here :P
Omg I got more ideas :D
I'll make the textarea display some stuff
so when I type /score in textField it displays :D
the possibilities are now endless :D
pastebin has loads of curious people lol views: 141
luckily it wasn't an important code :D
I realize I make too much use of smileys. I should stop
 
7:50 PM
Do your best to clean the code before adding features. It's a heck of a lot easier to extend clean code, than doing it the other way around
 
yep
That's exactly what I'm going to do now
Btw, is it possible to make my board functions separately?
because for now my BoardGrid makes the grid and has all the methods
 
What do you mean?
 
Since it extends JPanel, I can't extend anymore and using interface won't work in this case
I want to do this because I'm sure most(if not all) of my methods will be used if I try to make a computer player
 
Sure, you could have a class that implements all the logic. You could then pass an instance of that class to the board maybe as a parameter to the constructor
 
@kiheru What OS are you running?
 
7:55 PM
@Karl Linux (Fedora 20)
 
Wow that's brilliant!
@kiheru public BoardGrid(new BoardFunctions()){
Syntax error though
 
@Sabಠ_ಠ public BoardGrid(BoardFunctions bf)
pass the instance when you're actually calling BoardGrid constructor
 
what does that mean?
I don't think I can do it :S
 
Just a normal parameter definition
 
I decomposed each and everybit
and now everything requires the other
lol
So I guess I should use some methods from BoardGrid in itself when I want to make something else
 
8:08 PM
you can do:
`new BoardGrid(new BoardFunctions())`
when you create the board
 
but I will have to override some methods then
 
if you're worried about making the board, and the functions too tightly bound, make an interface of the functions. Then the board will not depend on the implementations
then, similarly as the board does not know anything about what the listeners do, or even about which class implements them, it would only be aware of the interface to the functions
 
Aha
I want to do a computer version now
user vs computer
I got a book on AI today I'll try it
I basically know in my mind what I should do but I'm not sure how AI works
 
There is nothing wrong with your computer @Sabಠ_ಠ
The problem is between the kb and the chair...
:P
 
@Karl I know :P
I was thinking of doing exactly the game BoardGrid when when player turn changes I make a method which doesn everything automatically
 
8:13 PM
The first rule of programming is: "it's my fault"
 
^It's always the programmers fault. :P
 
The storm that came through two days ago did some damage… That's your fault too!
 
Yeah
I don't tell this to people usually but I'll tell you a secret/
 
There are exceptions (I have run in to bugs in the compiler, standard library, drivers etc), but those are outliers
 
I control nature to some extent.
I only control wind and water though. Ssshhh
@kiheru can you build a compiler? :D
I wonder what it takes to build a compiler or an OS or even a new programming language
 
8:17 PM
It takes programming.
 
:D I wanna reach level 9000 :')
 
Seriously, if I remember right, Linux started off as a college school project.
 
PHd I think
 
No…It wasn't doctored, it was from scratch!
 
Linus wasn't an early programmer though. That gives me hope
I thought he wrote a paper about unix then went on to build it w/e
I forgot the history
 
8:19 PM
Linus was a friend of Charlie Brown
 
How cool is it that I'm lissening to Charlie Brown at this very moment?
 
Seriously @Sabಠ_ಠ, is Kiheru helping you with your checkers game?
 
@Karl yep. He taught me so much sooo much I can't even imagine
I could literally make tictactoe in 1 hour now, maybe less
 
He's good at that, isn't he
 
@Karl He is :)
 
8:27 PM
He could do it in 10 minutes...
11 if you wanted it fancy with ALL the bels and whistles!
 
I know right. I'm gonna reach this level soon :P
Maybe in 3 years xD
But in 3 years he'll already be a master spitting java out of the blue :D
 
He does that now
 

« first day (1420 days earlier)      last day (3515 days later) »