Astronomy application with which you can view the current position of planets, constellations and stars and other celestial objects from any point on the earth at any given time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SeaBattle | |
| class AIPlayer < Player | |
| def setup | |
| @boatSet.each do |boat| | |
| loop do | |
| i = rand(10) | |
| j = rand(10) | |
| boat.moveTo(i, j) | |
| boat.rotateTo(i + 1, j) | |
| break if @board.valid? boat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NetworkController | |
| def initialize(addr, port) | |
| socket = GCDAsyncSocket.alloc.initWithDelegate(self, delegateQueue:Dispatch::Queue.current.dispatch_object) | |
| err_ptr = Pointer.new(:object) | |
| if not socket.connectToHost(addr, onPort:port, error:err_ptr) | |
| puts "doesn't work: #{err_ptr[0]}" | |
| end | |
| socket.writeData("data\n".dataUsingEncoding(NSASCIIStringEncoding), withTimeout:-1, tag:1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ------------------------------------------------------------------------------ | |
| # dit is een proc | |
| check = lambda do |i| | |
| (i <= 5) # returned false als i > 5 | |
| end | |
| # we callen de proc voor alle i in 1..6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); | |
| glUniformMatrix4fv(LOC_BASIC_MVP, 1, GL_FALSE, GLKMatrix4Identity.m); | |
| glUniform4f(LOC_BASIC_COLOR, 1.0f, 0.0f, 0.0f, 1.0f); | |
| glBindBuffer(GL_ARRAY_BUFFER, unit_square_vertex_buffer); | |
| glEnableVertexAttribArray(0); | |
| glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float),(GLvoid*)0); | |
| glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SRInterfaceController* interface = [[SRInterfaceController alloc] init]; | |
| SomeGLKViewController* glVC = [[SomeGLKViewController alloc] initWithNibName:nil bundle:nil]; | |
| starVC.preferredFramesPerSecond = 60; | |
| [mainVC addChildViewController:interface]; | |
| [mainVC addChildViewController:glVC]; | |
| [[mainVC view] addSubview:[glVC view]]; | |
| [[mainVC view] addSubview:[interface view]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // relevant code before the call | |
| // ... | |
| glUseProgram(PROG_POINT); | |
| glUniformMatrix4fv(LOC_POINT_MVP, 1, GL_FALSE, modelViewProjectionMatrix.m); | |
| glUniform1i(LOC_POINT_TEXTURE, 0); | |
| glUniform4f(LOC_POINT_COLOR, 1.0f, 1.0f, 1.0f, 1.0f); | |
| glBindBuffer(GL_ARRAY_BUFFER, some_vertex_buffer); | |
| glEnableVertexAttribArray(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SeaBattle | |
| class Board | |
| def initialize | |
| @grid = Array.new(100, 0) | |
| end | |
| def set_boat(i, j, o, length) | |
| # o = orientation, 0 = right, 1 = down | |
| if(o == 0) | |
| for x in j...(j+length) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module TicTacToe | |
| class Board | |
| def initialize | |
| @grid = Array.new(9, -1) | |
| end | |
| def move(square, player) | |
| return false unless @grid[square] == -1 | |
| @grid[square] = player | |
| end |
NewerOlder