Skip to main content

Posts

Can't seem to get my method (in Java) to compile correctly

I am trying to figure out exactly what is wrong with my winorTie method in this little tictacttoe game I am trying to create. Would anyone be able to help? Thanks package tictactoegame; /** * * @author Douglas Boulden */ public class tictactoegame { static int [][] gameboard; static final int EMPTY = 0; static final int NOUGHT = -1; static final int CROSS = 1; static void set (int val, int row) throws IllegalArgumentException { int col = 0; if (gameboard[row][col] == EMPTY) gameboard[row][col] = val; else throw new IllegalArgumentException("Player already there!"); } static void displayBoard () { for (int[] gameboard1 : gameboard) { System.out.print("|"); for (int c = 0; c Solved Some of this was mentioned in the comments, but these conditions fundamentally don't make sense: if (gameboard [0][0] == NOUGHT && gameboard [0][...
Recent posts

Android : MPAndroidChart how to remove values on right side in chart?

I have the following chart which is displaying some values. I would like to hide/ remove values on the right side, because on the left side are enough. See image below: And code is following: public class MainActivity extends AppCompatActivity implements OnChartValueSelectedListener{ private LineChart mDataLineChart; private RelativeLayout mRelativeLayout; private LineChart mChart; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_linechart); // Set chart setChart(); // add data setData2(3, 155); // ANIMATE CHART animateChart(); } private void setChart() { mChart = (LineChart) findViewById(R.id.chart1); mChart.setOnChartValueSelectedListener(...

C# How to spawn Enemies and move them? [closed]

I am trying to spawn enemies and move them from left to right with a timer how can i do this? Example: int count; timer (every 1 sec) { Enemy somename+count = new Enemy(); count++; } timer (every 0.001 sec) { somename+count.x++; } Solved Your fundamental problem seems to be lacking a way to store references to all of your enemies. Generics and collections provide a solution to this type of problem. I'll use a List , which is the most basic such collection. There are many others, however, that each have their own useful properties. Consider : private class Enemy { public int position; } private List enemyList = new List (); private void timer1_Tick(object sender, EventArgs e) { enemyList.Add(new Enemy()); } private void timer2_Tick(object sender, EventArgs e) { foreach(Enemy enemy in enemyList) { enemy.position++; } } Also consider that updating a large list of visual objects every 0.001 second is useless and wast...

Billion number on Edge turns into a clickable ip

I use the " . " as thousand separator, so when i need to put some billion number on chrome,fox or IE it works fine, but on Edge the browser turns the text on a link. You can test this making a simple html and opening on diferent browsers. 1,999,999,999 1.100.100.000 How can i avoid this on Edge? Solved Your link isn't a clickable IP, but interpreted as a phone number. The answer https://stackoverflow.com/a/31867199/2897426 provides a way to disable automatic phone number detection, by adding the following meta tag to the of your html file: See the linked answer for further links.