my pseudo code here is some weird mix between C and lua :p
Just got home from work experience.I understand what you all have explained, But I don't understand why you would need to, apart from doing something to the whole array of items at once. Why not just make...string cubbyholebox1;string cubbyholebox2;string cubbyholebox3;if user says so and so, cubbyhole1= shoesI'm just confused by how its different. It kinda just seems tidier D:I thought of another use, which really might only apply to gmod, which could add a new line in the array each time it finds a specific object.
Quote from: toofast;1335471Cheers for that, it does sound like gtk. I will have a look today.GTK is C, not C++.
Cheers for that, it does sound like gtk. I will have a look today.
//the menu: m_refActionGroup = Gtk::ActionGroup::create(); //file menu: m_refActionGroup->add(Gtk::Action::create("FileMenu", "File")); m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), sigc::mem_fun(*this, &Gui::on_quit)); //view menu m_refActionGroup->add(Gtk::Action::create("ViewMenu", "View")); m_refActionGroup->add(Gtk::Action::create("ShowGraphs", "Graphs"), sigc::mem_fun(&graphs_window, &GraphsWindow::Show)); m_refActionGroup->add(Gtk::Action::create("ShowGPS", "GPS Plot"), sigc::mem_fun(&gpswindow, &GPSWindow::Show)); m_refActionGroup->add(Gtk::Action::create("Options", "Program Options"), sigc::mem_fun(¶meterswindow, &ParametersWindow::Show)); m_refActionGroup->add(Gtk::Action::create("StageWindow", "Create Stage Window"), sigc::mem_fun(*this, &Gui::on_create_laser_display)); //datalogging menu: m_refActionGroup->add(Gtk::Action::create("LogMenu", "Logging")); m_reflog_data = Gtk::ToggleAction::create("EnableLog", "Log Data?"); m_reflog_data->set_active(true); m_refActionGroup->add(m_reflog_data, sigc::mem_fun(*this, &Gui::on_log_data_clicked)); m_refstart_new_log = Gtk::Action::create("RestartLog", "Start New Logfile"); m_refActionGroup->add(m_refstart_new_log, sigc::mem_fun(*this, &Gui::on_log_data_clicked)); //help menu: m_refActionGroup->add(Gtk::Action::create("HelpMenu", "Help") ); m_refActionGroup->add(Gtk::Action::create("HelpAbout", Gtk::Stock::HELP), sigc::mem_fun(*this, &Gui::on_help) ); m_refUIManager = Gtk::UIManager::create();
TextBox::TextBox(string name) : m_clearbutton("Clear") { set_label(name); set_size_request(270,1); add(m_box); m_box.pack_start(m_scrolledwindow); m_box.pack_start(m_clearbox, PACK_SHRINK); m_clearbox.pack_start(m_clearbutton, PACK_SHRINK); m_clearbutton.signal_clicked().connect(sigc::mem_fun(*this, &TextBox::on_clearbutton)); //only show the scrollbars when they are necessary: m_scrolledwindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC); m_textview.set_editable(false); m_scrolledwindow.add(m_textview); m_reftextbuffer = TextBuffer::create(); m_textview.set_buffer(m_reftextbuffer); //for scrolling to the bottom: m_mark = m_reftextbuffer->create_mark(m_reftextbuffer->end(), false);}void TextBox::AddText(string const& text) { m_reftextbuffer->insert(m_reftextbuffer->end(), text); m_textview.scroll_to(m_mark);}void TextBox::on_clearbutton() { m_reftextbuffer->set_text("");}
Top Geary - 27th May 2016 at 12:10 AMI've learnt to ignore when you say derogatory things to me
#DEFINE white 0xFFFFFF#DEFINE red 0xFF0000#DEFINE green 0x00FFF0#DEFINE blue 0x0000FFicon[1],[1] = white; icon[2][1] = white ; icon[3][1] = white ; icon[4][1] = white ; icon[5][1] = white ; icon[6][1] = white ; icon[7][1] = white ; icon[8][1] = white ; icon[9][1] = white ; icon[10][1] = white ; icon[11][1] = white ; icon[12][1] = white ; icon[13][1] = white ; icon[14][1] = white ; icon[15][1] = white ; icon[16][1] = white ;icon[2][2] = red ; icon[3][2] = red ; icon[4][2] = white ; icon[5][2] = white ; icon[6][2] = white ; icon[7][2] = white ; icon[8][2] = white ; icon[9][2] = white ; icon[10][2] = white ; icon[11][2] = white ; icon[12][2] = white ; icon[13][2] = white ; icon[14][2] = white ; icon[15][2] = white ; icon[16][2] = white ;icon[2][3] = red ; icon[3][3] = red ; icon[4][3] = white ; icon[5][3] = white ; icon[6][3] = white ; icon[7][3] = white ; icon[8][3] = white ; icon[9][3] = white ; icon[10][3] = white ; icon[11][3] = white ; icon[12][3] = white ; icon[13][3] = white ; icon[14][3] = white ; icon[15][3] = white ; icon[16][3] = white ;icon[2][4] = white ; icon[3][4] = white ; icon[4][4] = green ; icon[5][4] = green ; icon[6][4] = white ; icon[7][4] = white ; icon[8][4] = white ; icon[9][4] = white ; icon[10][4] = white ; icon[11][4] = white ; icon[12][4] = white ; icon[13][4] = white ; icon[14][4] = white ; icon[15][4] = white ; icon[16][4] = white ;icon[2][5] = white ; icon[3][5] = white ; icon[4][5] = green ; icon[5][5] = green ; icon[6][5] = white ; icon[7][5] = white ; icon[8][5] = white ; icon[9][5] = white ; icon[10][5] = white ; icon[11][5] = white ; icon[12][5] = white ; icon[13][5] = white ; icon[14][5] = white ; icon[15][5] = white ; icon[16][5] = white ;icon[2][6] = white ; icon[3][6] = white ; icon[4][6] = white ; icon[5][6] = white ; icon[6][6] = blue ; icon[7][6] = blue ; icon[8][6] = white ; icon[9][6] = white ; icon[10][6] = white ; icon[11][6] = white ; icon[12][6] = white ; icon[13][6] = white ; icon[14][6] = white ; icon[15][6] = white ; icon[16][6] = white ;icon[2][7] = white ; icon[3][7] = white ; icon[4][7] = white ; icon[5][7] = white ; icon[6][7] = blue ; icon[7][7] = blue ; icon[8][7] = white ; icon[9][7] = white ; icon[10][7] = white ; icon[11][7] = white ; icon[12][7] = white ; icon[13][7] = white ; icon[14][7] = white ; icon[15][7] = white ; icon[16][7] = white ;icon[2][8] = white ; icon[3][8] = white ; icon[4][8] = white ; icon[5][8] = white ; icon[6][8] = white ; icon[7][8] = white ; icon[8][8] = white ; icon[9][8] = white ; icon[10][8] = white ; icon[11][8] = white ; icon[12][8] = white ; icon[13][8] = white ; icon[14][8] = white ; icon[15][8] = white ; icon[16][8] = white ;icon[2][9] = white ; icon[3][9] = white ; icon[4][9] = white ; icon[5][9] = white ; icon[6][9] = white ; icon[7][9] = white ; icon[8][9] = white ; icon[9][9] = white ; icon[10][9] = white ; icon[11][9] = white ; icon[12][9] = white ; icon[13][9] = white ; icon[14][9] = white ; icon[15][9] = white ; icon[16][9] = white ;icon[2][10] = white ; icon[3][10] = white ; icon[4][10] = white ; icon[5][10] = white ; icon[6][10] = white ; icon[7][10] = white ; icon[8][10] = white ; icon[9][10] = white ; icon[10][10] = white ; icon[11][10] = white ; icon[12][10] = white ; icon[13][10] = white ; icon[14][10] = white ; icon[15][10] = white ; icon[16][10] = white ;icon[2][11] = white ; icon[3][11] = white ; icon[4][11] = white ; icon[5][11] = white ; icon[6][11] = white ; icon[7][11] = white ; icon[8][11] = white ; icon[9][11] = white ; icon[10][11] = white ; icon[11][11] = white ; icon[12][11] = white ; icon[13][11] = white ; icon[14][11] = white ; icon[15][11] = white ; icon[16][11] = white ;icon[2][12] = white ; icon[3][12] = white ; icon[4][12] = white ; icon[5][12] = white ; icon[6][12] = white ; icon[7][12] = white ; icon[8][12] = white ; icon[9][12] = white ; icon[10][12] = white ; icon[11][12] = white ; icon[12][12] = white ; icon[13][12] = white ; icon[14][12] = white ; icon[15][12] = white ; icon[16][12] = white ;icon[2][13] = white ; icon[3][13] = white ; icon[4][13] = white ; icon[5][13] = white ; icon[6][13] = white ; icon[7][13] = white ; icon[8][13] = white ; icon[9][13] = white ; icon[10][13] = white ; icon[11][13] = white ; icon[12][13] = white ; icon[13][13] = white ; icon[14][13] = white ; icon[15][13] = white ; icon[16][13] = white ;icon[2][14] = white ; icon[3][14] = white ; icon[4][14] = white ; icon[5][14] = white ; icon[6][14] = white ; icon[7][14] = white ; icon[8][14] = white ; icon[9][14] = white ; icon[10][14] = white ; icon[11][14] = white ; icon[12][14] = white ; icon[13][14] = white ; icon[14][14] = white ; icon[15][14] = white ; icon[16][14] = white ;icon[2][15] = white ; icon[3][15] = white ; icon[4][15] = white ; icon[5][15] = white ; icon[6][15] = white ; icon[7][15] = white ; icon[8][15] = white ; icon[9][15] = white ; icon[10][15] = white ; icon[11][15] = white ; icon[12][15] = white ; icon[13][15] = white ; icon[14][15] = white ; icon[15][15] = white ; icon[16][15] = white ;icon[2][16] = white ; icon[3][16] = white ; icon[4][16] = white ; icon[5][16] = white ; icon[6][16] = white ; icon[7][16] = white ; icon[8][16] = white ; icon[9][16] = white ; icon[10][16] = white ; icon[11][16] = white ; icon[12][16] = white ; icon[13][16] = white ; icon[14][16] = white ; icon[15][16] = white ; icon[16][16] = white ;
for (int x=1, int y=1, x<8, y<8, x++, y++){print(x,y)return 0;}
You should be able to do both (2p & ai) really easy Kayne.
FUCK YOU MULTI DIMENSIONAL ARRAYS.
Five dimensional arrays are your friend
JPanel[]squares=new JPanel[9];for(int i=0;i<squares.length;i++){squares[i]=new JPanel();}
board[horizontal-index][vertical-index]
Quote from: `Kayne;1335762FUCK YOU MULTI DIMENSIONAL ARRAYS.Quote from: Tiwaking!;1333600Five dimensional arrays are your friendI'll give you some help with the tic tac toe thing, not alot of help since it is in java.Code: [Select]JPanel[]squares=new JPanel[9];for(int i=0;i<squares.length;i++){squares[i]=new JPanel();}Normally I would EXTEND the JPanel to hold a custom picture and call the JPanel's "GamePanel". That way you can use them to hold the player as well so when you check through the played tiles you just need to do a simpley for loop thingy.Tic tac toe is hard to write, despite what the huge nerds say in this thread. You can give this a go. It was an old alpha version of my flat mates "Keith n Crosses" game so it has alot of bugs the finished version does not.See if you can figure out how it was made.http://tiwaking.hostzi.com/keithncrosses/index.html
JPanel[]squares=new JPanel[9];for(int i=0;i<squares.length;i++){squares[i]=new JPanel();}
Nobody will ever win the battle of the sexes...there\'s too much fraternizing with the enemy.-Henry Kissinger
Also, how is the game strange?
Quote from: Xenolightning;1335680Also, how is the game strange? lol, it was a quote from Wargames, awesome movie.
Pokemon arent real but they should be.
public class Variables { public static string[, , ,] Easy; {{"E","A","S","Y"},{"e","a","s","y"}} }
[E] [A] [S] [Y][e] [a] [s] [y]
{ public static string[, , ,] Easy = { {E,A,S,Y},{e,a,s,y} }; }
Code: [Select] public class Variables { public static string[, , ,] Easy; {{"E","A","S","Y"},{"e","a","s","y"}} }
JPanel sounds awfully non-console...And that's a single dimension array!
public class BoardRow extends JPanel{JPanel[]lines=new JPanel[3];}//class
public class Board extends JPanel{BoardRow[]rows=new BoardRow[3];}//class
Noughts and crosses isn't hard to write. It's more about having the commitment to see it through.
I can't see how to make the player win.. If i'm going to make a bot I want it to never lose lol
Quote from: `Kayne;1336005I can't see how to make the player win.. If i'm going to make a bot I want it to never lose lolUm, you know it's Tic-Tac-Toe right?It always ends in a draw, unless one player does a stupid mistake.
Just do a string.ToLowerCase(); Then match the result of that.string name = "SpAcEMONkey";string lowerCaseName = name.ToLowerCase();